/* KIVERSE web surface — one stylesheet, no build step.
 *
 * Direction: a filing cabinet, not a dashboard. The material is five years of
 * Greek and English paperwork, so the page reads as index cards with a
 * coloured spine per business, dates set like a rubber stamp, and search hits
 * marked the way you would run a highlighter over a form. Everything else
 * stays quiet.
 *
 * Type is the system UI stack on purpose: it is the only way to get proper
 * Greek coverage on every device with no webfont download on cellular. */

:root {
  color-scheme: light dark;

  --paper:      #f2f2ef;
  --card:       #ffffff;
  --ink:        #171e28;
  --ink-soft:   #58616e;
  --ink-faint:  #8b939f;
  --rule:       #e0dfda;
  --stamp:      #5b3fa8;   /* rubber-stamp violet — hits, focus, links */
  --stamp-wash: #ece7fa;

  --biz-selina-productions: #0f766e;
  --biz-hahana-kids:        #c2410c;
  --biz-akion:              #1d4ed8;
  --biz-happybites:         #a16207;
  --biz-personal:           #52606d;
  --biz-none:               #c9c8c2;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --gap: 1rem;
  --radius: 3px;   /* cards are filed, not floating — keep corners almost sharp */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #14171c;
    --card:       #1b1f26;
    --ink:        #e7e5e0;
    --ink-soft:   #a3abb6;
    --ink-faint:  #6f7884;
    --rule:       #2b3038;
    --stamp:      #a78bfa;
    --stamp-wash: #2c2547;

    --biz-selina-productions: #2dd4bf;
    --biz-hahana-kids:        #fb923c;
    --biz-akion:              #7aa2ff;
    --biz-happybites:         #fbbf24;
    --biz-personal:           #94a3b8;
    --biz-none:               #3a4049;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: 4rem;
}

a { color: var(--stamp); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 2px;
  border-radius: 2px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
}
.dim { color: var(--ink-faint); }

/* ---------- header ------------------------------------------------------ */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 0.75rem var(--gap) 0.5rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
}

.wordmark {
  display: inline-block;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.625rem;
}
.wordmark:hover { text-decoration: none; }
.wordmark-k { color: var(--stamp); }
.wordmark-rest { color: var(--ink-soft); }

.find { display: flex; gap: 0.5rem; }

.find input[type="search"] {
  flex: 1;
  min-width: 0;
  /* 17px keeps iOS Safari from zooming the viewport on focus. */
  font-size: 17px;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.625rem 0.75rem;
  appearance: none;
}
.find input::placeholder { color: var(--ink-faint); }
.find input:focus { border-color: var(--stamp); outline: none; box-shadow: 0 0 0 3px var(--stamp-wash); }

.find button {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--paper);
  background: var(--stamp);
  border: 0;
  border-radius: var(--radius);
  padding: 0 1rem;
  cursor: pointer;
}
.find button:hover { filter: brightness(1.08); }

/* Ask is the second verb on the same box. Outlined rather than filled: Find is
   what you reach for twenty times a day, Ask is the deliberate one. */
.find button.ask {
  color: var(--stamp);
  background: transparent;
  border: 1px solid var(--stamp);
  padding: 0 0.875rem;
}
.find button.ask:hover { background: var(--stamp-wash); filter: none; }

/* ---------- ask ---------------------------------------------------------- */

.asked {
  font-size: 1.1875rem !important;
  font-weight: 600 !important;
  line-height: 1.35;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.answer {
  border-left: 4px solid var(--stamp);
  background: var(--card);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.875rem 1rem;
  margin-top: 0.25rem;
}
.answer p { margin: 0 0 0.75rem; line-height: 1.6; overflow-wrap: anywhere; }
.answer p:last-child, .answer ul:last-child { margin-bottom: 0; }
.answer ul { margin: 0 0 0.75rem; padding-left: 1.125rem; }
.answer li { margin-bottom: 0.3125rem; line-height: 1.5; overflow-wrap: anywhere; }
.answer strong { font-weight: 650; }

/* ---------- conversation ------------------------------------------------ */

.turn { padding: 1.25rem 0 0; }
.turn + .turn { border-top: 1px solid var(--rule); margin-top: 1.25rem; }

.turn-meta { margin: 0.375rem 0 0; color: var(--ink-faint); }

.sources { margin-top: 0.625rem; }
.sources .results { margin-top: 0.5rem; }

.reply {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.reply textarea {
  flex: 1;
  min-width: 0;
  /* 17px keeps iOS Safari from zooming the viewport on focus. */
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.5rem 0.625rem;
  resize: vertical;
}
.reply textarea:focus {
  border-color: var(--stamp);
  outline: none;
  box-shadow: 0 0 0 3px var(--stamp-wash);
}
.reply button {
  font: inherit;
  font-weight: 600;
  color: var(--paper);
  background: var(--stamp);
  border: 0;
  border-radius: var(--radius);
  padding: 0.625rem 1rem;
  cursor: pointer;
}
.reply button[disabled] { opacity: 0.5; cursor: default; }

.thinking { padding: 1.25rem 0 0.5rem; }
.pulse {
  margin: 0;
  color: var(--ink-soft);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.chips {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.625rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 0.25rem 0.6875rem;
}
.chip:hover { text-decoration: none; border-color: var(--ink-faint); }
.chip.on {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

/* ---------- page furniture ---------------------------------------------- */

main { padding: 0 var(--gap); max-width: 46rem; margin: 0 auto; }

.lead { padding: 1.25rem 0 0.75rem; }
.lead h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.lead .sub { margin: 0.1875rem 0 0; color: var(--ink-soft); font-size: 0.9375rem; }

.notice {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  background: var(--stamp-wash);
  border-left: 3px solid var(--stamp);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.875rem;
  color: var(--ink);
}

.empty { color: var(--ink-soft); padding: 1.5rem 0; }

.foot-note {
  margin: 1rem 0 0;
  color: var(--ink-faint);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* ---------- result cards ------------------------------------------------ */

.results { display: flex; flex-direction: column; gap: 0.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--spine, var(--biz-none));
  border-radius: var(--radius);
  transition: border-color 120ms ease;
}
.card:hover { border-color: var(--ink-faint); border-left-color: var(--spine, var(--biz-none)); }

.card-link { display: block; padding: 0.75rem 0.875rem; color: inherit; }
.card-link:hover { text-decoration: none; }

.card-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.25rem;
}

.date { color: var(--ink-faint); letter-spacing: 0.02em; }

.tag {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--spine, var(--ink-soft));
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 0.0625rem 0.3125rem;
  opacity: 0.9;
}
.tag.ghost { color: var(--ink-faint); font-weight: 500; }

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.card-snippet {
  margin: 0.3125rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

mark {
  background: var(--stamp-wash);
  color: inherit;
  box-shadow: inset 0 -0.4em 0 var(--stamp-wash);
  border-bottom: 1.5px solid var(--stamp);
  padding: 0 0.0625rem;
  border-radius: 1px;
}

.card-people {
  margin: 0.375rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

/* Business spines. One custom property drives the border, the tag colour and
   the chip, so a new business is one line here plus one line in app.py. */
.biz-selina-productions { --spine: var(--biz-selina-productions); }
.biz-hahana-kids        { --spine: var(--biz-hahana-kids); }
.biz-akion              { --spine: var(--biz-akion); }
.biz-happybites         { --spine: var(--biz-happybites); }
.biz-personal           { --spine: var(--biz-personal); }
.biz-none               { --spine: var(--biz-none); }

.chip.biz-selina-productions:not(.on),
.chip.biz-hahana-kids:not(.on),
.chip.biz-akion:not(.on),
.chip.biz-happybites:not(.on),
.chip.biz-personal:not(.on) { border-color: var(--spine); color: var(--spine); }
.chip.on { --spine: var(--ink); }

/* ---------- pager ------------------------------------------------------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 1.25rem 0;
}

/* ---------- document page ----------------------------------------------- */

.doc { padding: 1.25rem 0 0; }

.doc-title {
  margin: 0.25rem 0 0;
  font-size: 1.375rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.block { margin-top: 1.5rem; }
.block h2 {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.prose { margin: 0; font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere; }

.pills { display: flex; flex-wrap: wrap; gap: 0.3125rem; margin: 0; padding: 0; list-style: none; }
.pill {
  font-size: 0.8125rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 0.1875rem 0.625rem;
}
.pill.ghost { background: transparent; color: var(--ink-soft); }

.questions { margin: 0; padding-left: 1.125rem; color: var(--ink-soft); font-size: 0.9375rem; }
.questions li { margin-bottom: 0.25rem; overflow-wrap: anywhere; }

.reveal { cursor: pointer; color: var(--stamp); font-size: 0.875rem; }

.raw {
  margin: 0.625rem 0 0;
  padding: 0.75rem;
  max-height: 26rem;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.provenance dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; }
.provenance dt { color: var(--ink-faint); }
.provenance dd { margin: 0; overflow-wrap: anywhere; }
.provenance .wrap { word-break: break-all; }

/* ---------- status ------------------------------------------------------ */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.5rem;
  margin: 0;
}
.figures > div {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.figures dt { font-size: 0.75rem; color: var(--ink-faint); }
.figures dd { margin: 0.125rem 0 0; font-size: 1.25rem; font-weight: 600; }

/* ---------- footer ------------------------------------------------------ */

.foot {
  display: flex;
  justify-content: space-between;
  max-width: 46rem;
  margin: 2rem auto 0;
  padding: 1rem var(--gap);
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* Reading progress — the switch is the reason this page exists, so it reads
   as a control and not as another figure. Colour is not the only signal:
   the words say ON or OFF too, for a phone in bright sun and for anyone who
   does not separate red from green. */
.switch-box {
  border: 1px solid var(--line, #d8d5cf);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin: 1.25rem 0 1.75rem;
  display: grid;
  gap: .75rem;
}
.switch-box.is-on  { border-left-color: #2f7a4f; }
.switch-box.is-off { border-left-color: #9a5b1e; }
.switch-state { display: grid; gap: .2rem; }
.switch-state strong { font-size: 1.05rem; }
.switch-state small { opacity: .65; }
.switch-box form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.switch-box input[type=text] {
  flex: 1 1 16rem; min-width: 0; padding: .5rem .6rem;
  border: 1px solid var(--line, #d8d5cf); border-radius: 6px;
  font: inherit; background: transparent; color: inherit;
}
.switch-box button {
  padding: .55rem 1.1rem; border-radius: 6px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn-off { background: #9a5b1e; color: #fff; }
.btn-on  { background: #2f7a4f; color: #fff; }
.switch-box button:hover { filter: brightness(1.08); }
.switch-note { margin: 0; opacity: .7; font-size: .9rem; }

/* ── the door (auth.py) ─────────────────────────────────────────────── */
.auth { display: grid; gap: .75rem; max-width: 26rem; margin: 1rem auto; }
.auth label { display: grid; gap: .25rem; font-weight: 600; }
.auth input[type=password], .auth input[type=text] { font-size: 1.1rem; padding: .6rem; }
.auth .check { font-weight: 400; }
.auth-alt { max-width: 26rem; margin: 1rem auto; }
.codes { columns: 2; max-width: 20rem; margin: 1rem auto; font-size: 1.2rem; }
.inline { display: inline; }
.linklike { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.ok { color: #2a7; }
.bad { color: #c33; font-weight: 700; }
