/* ============================================================
   Jan Software — Brand Tokens v1.0 ("Ink & Iris") — Jan Tutor copy.
   Canonical: jansoftware-site/brand-tokens.css (each product keeps its own copy).
   Ink #0B0C0F · Paper #FAFAF9 · Iris #5A48F2 · Iris Bright #8B7CFF (dark)
   Abyss #08090C · Slate #3C4048 · Line #E7E5DF · Verified green #0B8A5F.
   ============================================================ */
:root{
  --bg:#FAFAF9; --bg2:#F2F1ED;
  --surface:#FFFFFF; --surface2:#F6F5F1;
  --ink:#0B0C0F; --ink2:#3C4048; --muted:#6F7278;
  --line:#E7E5DF;
  --accent:#845A0F; --accent2:#C98F2D; --accent-soft:#F7ECD4;
  --on-accent:#FFFFFF;
  --ok:#08734F; --ok-soft:#E3F2EA; --verified-swatch:#0B8A5F;
  --success:#08734F; --warning:#8A5700; --error:#B42318; --info:#245CC5; --money-in:#08734F; --money-out:#3C4048; --border-functional:#686C75; --text-secondary-dark:#BDC2CC; --surface-2-dark:#17191F; --iris:#5A48F2; --iris-bright:#8B7CFF; --iris-deep:#4639BF; --focus:#5A48F2;
  --shadow:0 1px 2px rgba(11,12,15,.05),0 12px 32px -12px rgba(11,12,15,.12);
  --glow:0 10px 28px -10px rgba(132,90,15,.45);
  --font-display:'Space Grotesk','Noto Sans Ethiopic',sans-serif;
  --font-body:'Inter','Noto Sans Ethiopic',system-ui,sans-serif;
  --radius-card:16px; --radius-pill:999px;
  /* legacy aliases (pre-reskin names used across this sheet) */
  --green:var(--success); --amber:var(--warning);
}
[data-theme="dark"]{
  --bg:#08090C; --bg2:#0C0D11;
  --surface:#101116; --surface2:#17181F;
  --ink:#F5F4F0; --ink2:#C7C9CF; --muted:#8E9199;
  --line:#23242C;
  --accent:#E1AD63; --accent2:#EFC987; --accent-soft:#2E2410;
  --on-accent:#0B0C0F;
  --ok:#35C991; --ok-soft:#0E2A20;
  --success:#35C991; --warning:#F2B84B; --error:#FF8F99; --info:#8BB8FF; --money-in:#35C991; --money-out:#BDC2CC; --border-functional:#686C75; --focus:#8B7CFF;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 12px 32px -12px rgba(0,0,0,.55);
  --glow:0 10px 28px -10px rgba(225,173,99,.4);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); background: var(--bg); color: var(--ink); }
h1, h2, h3, .logo, .deck-title, .stats strong { font-family: var(--font-display); }
button, input, select, textarea { font-family: inherit; }
a { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.topbar { background: #0B0C0F; color: #FAFAF9; border-bottom: 1px solid var(--line); padding: 12px 0; position: sticky; top: 0; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.topbar a { color: #FAFAF9; text-decoration: none; margin-right: 14px; font-size: 15px; }
.logo { font-weight: 700; font-size: 18px; display: inline-flex; align-items: center; gap: 9px; }
.logo img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.footbrand { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 700; color: var(--ink); margin-right: 8px; }
.footbrand img { width: 20px; height: 20px; border-radius: 5px; display: block; }
main.wrap { padding-top: 20px; padding-bottom: 40px; }
footer { border-top: 1px solid var(--line); padding: 18px 0; color: var(--muted); font-size: 13px; background: var(--surface); }
.hero { text-align: center; padding: 36px 0; }
.hero h1 { font-size: 34px; margin: 0 0 8px; }
.tagline { color: var(--ink2); margin: 0 0 20px; }
.stats { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 20px; }
.stats strong { display: block; font-size: 22px; color: var(--accent); }
.stats span { font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 10px; background: var(--surface);
       border: 2px solid var(--accent); color: var(--accent); text-decoration: none; font-weight: 700; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--glow); }
.how { background: var(--surface); border-radius: 14px; padding: 20px; margin-top: 20px; }
.bcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
         padding: 16px; margin: 10px 0; text-decoration: none; color: inherit; }
.bcard strong { font-size: 17px; }
.bcard span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 18px; margin: 14px 0; }
textarea, select, input[type=text], input[type=password], input[type=tel] {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; margin: 6px 0; background: var(--surface); color: var(--ink); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row select { flex: 1; min-width: 120px; }
button { background: var(--accent); color: var(--on-accent); border: none; border-radius: 8px;
         padding: 12px 24px; font-size: 16px; font-weight: 700; cursor: pointer; }
.opt { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; cursor: pointer; }
.opt input { margin-right: 8px; }
.qtext { font-size: 18px; line-height: 1.6; }
.flash { padding: 14px; border-radius: 10px; margin: 12px 0; font-weight: 700; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.bad { background: #FDECEC; color: var(--error); }
.error { color: var(--error); font-weight: 700; }
.muted { color: var(--muted); }
.answer-text { line-height: 1.7; white-space: pre-wrap; }
.websrc { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; font-weight: 600; }
/* suggested-question chips (one-tap asking on small keyboards) */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin-top: 8px;
  scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; background: var(--accent-soft); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 9px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:active { background: var(--accent-soft); }
/* expandable source quotes */
.sources details { margin-top: 4px; }
.sources summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600;
  padding: 6px 0; min-height: 32px; }
.quote { background: var(--bg2); border-left: 3px solid var(--accent); margin: 4px 0 8px;
  padding: 10px 12px; font-size: 13.5px; line-height: 1.7; color: var(--ink2); border-radius: 0 8px 8px 0; }
.sources { font-size: 13px; color: var(--ink2); }
.chunk { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; }
.chunk h3 { margin: 0 0 8px; font-size: 16px; }
.chunk small { color: var(--muted); font-weight: 400; }
.chunk p { line-height: 1.8; margin: 0; }

/* --- slim top bar + bottom tab bar (mobile-first) --- */
.topbar.slim { padding: 0; }
.topbar.slim .wrap { display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding-top: 0; padding-bottom: 0; }
.topact { display: flex; align-items: center; gap: 4px; }
.ticon { color: #FAFAF9; text-decoration: none; font-size: 15px; padding: 8px 10px;
  border-radius: 8px; min-width: 44px; min-height: 44px; display: inline-flex;
  align-items: center; justify-content: center; }
.ticon:active { background: rgba(255,255,255,.15); }
body { padding-bottom: 76px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 12px rgba(0,0,0,.06); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 7px; text-decoration: none; color: var(--muted); font-size: 11px;
  font-weight: 600; min-height: 60px; justify-content: center; }
.tico { font-size: 21px; line-height: 1; }
.tab.active { color: var(--accent); }
.tab.active .tico { transform: scale(1.12); }
.tab:active { background: var(--surface2); }
footer { margin-bottom: 0; }

/* --- calculator --- */
.calc { max-width: 420px; margin: 0 auto; }
.calc-display { background: #0B0C0F; color: #FAFAF9; border-radius: 14px; padding: 18px 16px;
  text-align: right; margin-bottom: 12px; min-height: 96px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.calc-expr { font-size: 15px; color: #8E9199; min-height: 20px; word-break: break-all; }
.calc-out { font-size: 34px; font-weight: 700; word-break: break-all; }
.calc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.calc-grid button { padding: 0; height: 56px; font-size: 17px; border-radius: 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.calc-grid button.fn { background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.calc-grid button.op { background: var(--accent-soft); color: var(--accent); }
.calc-grid button.eq { background: var(--accent); color: var(--on-accent); grid-row: span 2; height: auto; min-height: 120px; }
.calc-grid button.clr { background: #FDECEC; color: var(--error); }
.calc-grid button:active { transform: scale(.96); }
.calc-hist { margin-top: 14px; font-size: 13px; color: var(--muted); }
.calc-hist div { padding: 6px 0; border-bottom: 1px dashed var(--line); }

/* --- bookshelf --- */
.shelf-filters { margin: 6px 0 14px; }
.shelf-filters .searchbar { margin-bottom: 10px; }
.shelf-filters .frow { margin-top: 10px; }
.chips .chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 560px) { .shelf { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.book-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; }
.book-cover { position: relative; display: block; aspect-ratio: 3/4; background: var(--surface2); overflow: hidden; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-cta { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px; text-align: center;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff; font-weight: 700; font-size: 14px;
  opacity: 0; transition: opacity .15s; }
.book-card:active .book-cta, .book-cover:hover .book-cta { opacity: 1; }
.book-meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.book-meta strong { font-size: 14px; line-height: 1.35; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 3px 9px; font-size: 11.5px; font-weight: 700; }
.badge.dim { background: var(--surface2); color: var(--muted); font-weight: 600; }
.book-read.btn.small { padding: 8px 14px; font-size: 14px; text-align: center; margin-top: auto; }
.book-read.btn.small.primary { background: var(--accent); color: var(--on-accent); }
.resume { font-size: 12px; }

/* --- reader --- */
.reader { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.reader-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  background: var(--surface2); border-bottom: 1px solid var(--line); position: sticky; top: 52px; z-index: 20; flex-wrap: wrap; }
.rbtn { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  min-width: 44px; min-height: 44px; font-size: 18px; font-weight: 700; padding: 6px 10px; cursor: pointer; }
.rbtn:active { background: var(--accent-soft); }
.rpage { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 15px; }
.rpage input { width: 58px; text-align: center; padding: 8px 4px; margin: 0; font-size: 15px; }
.rsp { flex: 1; }
.reader-stage { position: relative; min-height: 420px; display: flex; justify-content: center;
  align-items: flex-start; padding: 12px 6px; background: #525659; overflow: auto; }
.reader-stage canvas { background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,.35); border-radius: 2px; }
.reader-loading { position: absolute; top: 40%; color: #fff; font-weight: 600; }
.reader:fullscreen { border-radius: 0; }
.reader:fullscreen .reader-stage { min-height: 90vh; }
.reader-hint { padding: 0 12px; }
.reader-fail { text-align: center; padding: 40px 20px; color: #fff; }
.reader-fail p { margin: 10px 0; }
.reader-fail .rbtn { margin: 4px; }

/* --- scroll reader --- */
.pages { position: relative; background: #525659; padding: 12px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 60vh; }
.page { position: relative; background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,.35); border-radius: 2px; }
.page canvas { display: block; width: 100%; height: 100%; }
.textLayer { position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden;
  line-height: 1; opacity: 1; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre;
  cursor: text; transform-origin: 0% 0%; }
.textLayer .endOfContent { display: block; position: absolute; left: 0; top: 100%;
  right: 0; bottom: 0; z-index: -1; cursor: default; user-select: none; }
.textLayer ::selection { background: rgba(90,72,242,.35); }
.explain-fab { position: fixed; z-index: 200; background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 999px; padding: 13px 22px; font-size: 15px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,.4); cursor: pointer; }
.explain-fab:active { transform: scale(.95); }
.reader:fullscreen .pages { min-height: 92vh; }

/* --- continue reading strip --- */
.sech { font-size: 17px; margin: 14px 0 6px; }
.recent-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.recent-strip::-webkit-scrollbar { display: none; }
.recent-card { flex: 0 0 auto; width: 210px; display: flex; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  text-decoration: none; color: inherit; }
.recent-card img { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; background: var(--surface2); }
.recent-card strong { display: block; font-size: 13px; line-height: 1.3; }
.recent-card span { font-size: 12px; color: var(--muted); }
.recent-card:active { background: var(--surface2); }

/* --- slide decks --- */
.deck { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.deck-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: var(--surface2); }
.deck-title { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-stage { position: relative; min-height: 380px; }
.slide { padding: 34px 26px 26px; min-height: 380px; position: relative;
  animation: slidein .25s ease; }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.slide-num { position: absolute; top: 14px; right: 16px; background: var(--accent-soft); color: var(--accent);
  font-weight: 800; border-radius: 999px; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center; font-size: 14px; }
.slide h2 { font-size: 24px; margin: 0 44px 16px 0; line-height: 1.3; color: var(--ink); }
.slide ul { margin: 0; padding: 0; list-style: none; }
.slide li { font-size: 17px; line-height: 1.55; padding: 9px 0 9px 28px; position: relative;
  border-bottom: 1px dashed var(--line); }
.slide li:before { content: "▸"; position: absolute; left: 4px; color: var(--accent); font-weight: 800; }
.slide li:last-child { border-bottom: none; }
.slide-src { margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.slide.title-slide { background: linear-gradient(135deg, #5A48F2 0%, #7A5AF5 60%, #9D4CF2 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: center; }
.slide.title-slide h2 { color: #fff; font-size: 30px; }
.slide.title-slide li { color: #EDEAFF; border-bottom-color: rgba(255,255,255,.18); font-size: 18px; }
.slide.title-slide li:before { color: #FFFFFF; }
.slide.title-slide .slide-num { background: rgba(255,255,255,.2); color: #fff; }
.slide.title-slide .slide-src { color: #D9D2FF; }
.deck-nav { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface2); }
.dots { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.dot { width: 10px; height: 10px; border-radius: 999px; background: var(--line); cursor: pointer; }
.dot.on { background: var(--accent); transform: scale(1.25); }
.deck:fullscreen { border-radius: 0; }
.deck:fullscreen .slide { min-height: 80vh; }

/* --- write-my-own slide editor --- */
.scard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.shead { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.snum { background: var(--accent-soft); color: var(--accent); font-weight: 800; border-radius: 999px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.mini { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 14px; }
.mini.danger { color: #a00; }
