/*!
 * Thirukkural Online V1.1
 * Created by Jayakanthan M. Lachmanan, 11 October 2026.
 */
:root {
  --paper: #F1F3EF;
  --surface: #FFFFFF;
  --ink: #1C2433;
  --ink-2: #4B5567;
  --line: #D5DAD2;
  --leaf: #E8D29B;
  --leaf-hi: #F1DFAF;
  --leaf-edge: #C4A35A;
  --leaf-ink: #2D1F0E;
  --accent: #8A5606;
  --accent-soft: #F6EAD2;
  --green: #2E5A47;
  --green-soft: #E3EDE7;
  --focus: #B87A12;
  --f-ui: "Mukta Malar", "Noto Sans Tamil", "Segoe UI", system-ui, sans-serif;
  --f-ta: "Noto Serif Tamil", "Noto Sans Tamil", "Latha", serif;
  --f-read: "Spectral", "Noto Serif", Georgia, serif;
  --radius-leaf: 999px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12161D; --surface: #1A1F28; --ink: #E6E8EC; --ink-2: #A9B0BD; --line: #2E3542;
    --leaf: #D9BF7E; --leaf-hi: #E5CF96; --leaf-edge: #A9863F; --leaf-ink: #24180A;
    --accent: #E3A947; --accent-soft: #2A2416; --green: #8CC2A6; --green-soft: #1C2A24; --focus: #E3A947;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12161D; --surface: #1A1F28; --ink: #E6E8EC; --ink-2: #A9B0BD; --line: #2E3542;
  --leaf: #D9BF7E; --leaf-hi: #E5CF96; --leaf-edge: #A9863F; --leaf-ink: #24180A;
  --accent: #E3A947; --accent-soft: #2A2416; --green: #8CC2A6; --green-soft: #1C2A24; --focus: #E3A947;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--f-ui);
}
[lang="ta"] { font-family: var(--f-ta); }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 600; }
p { margin: 0 0 1em; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-2); }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.head-row, .ask { max-width: 1260px; margin: 0 auto; padding: 0 24px; }
.head-row { display: flex; align-items: center; gap: 28px; padding-top: 18px; }
.brand { display: flex; align-items: baseline; gap: 12px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand-ta { font-size: 1.75rem; font-weight: 700; color: var(--green); letter-spacing: .01em; }
.brand-en { font-weight: 600; font-size: 1.05rem; }
.brand-sub { font-weight: 400; color: var(--ink-2); }
.tabs { display: flex; gap: 4px; }
.tabs a { color: var(--ink-2); text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 500; }
.tabs a:hover { color: var(--ink); background: var(--paper); }
.tabs a[aria-current="page"] { color: var(--green); background: var(--green-soft); }
.chap-toggle { display: none; }

.ask { position: relative; padding-top: 14px; padding-bottom: 20px; }
.ask-label { display: block; font-weight: 500; margin-bottom: 8px; }
.ask-field { display: flex; gap: 8px; }
.ask-field input {
  flex: 1; min-width: 0; font: inherit; font-size: 1.1rem; color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 16px;
}
.ask-field input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-soft); }
.ask-field button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 22px; cursor: pointer;
  background: var(--green); color: #fff;
}
.ask-field button:hover, .btn:hover { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ask-field button, :root:not([data-theme="light"]) .btn { color: #0F1A14; } }
.ask-hint { color: var(--ink-2); font-size: .9rem; margin: 6px 0 0; }
.ask-suggest {
  position: absolute; left: 24px; right: 24px; top: calc(100% - 26px); z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 18px 40px -18px rgba(20, 30, 40, .35); max-height: 70vh; overflow: auto;
}
.sg { display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.sg:hover, .sg.is-active { background: var(--paper); }
.sg-top { display: block; font-size: .85rem; color: var(--green); font-weight: 600; }
.sg-ta { display: block; font-size: 1rem; }
.sg-mean { display: block; color: var(--ink-2); font-size: .92rem; }
.sg-all { font-weight: 600; color: var(--accent); }

/* ---------- Layout ---------- */
.layout {
  max-width: 1260px; margin: 0 auto; padding: 32px 24px 48px;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start;
}
main:focus { outline: none; }

/* ---------- Chapter panel ---------- */
.chapters {
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 12px 20px;
  overscroll-behavior: contain;
}
.chapters-head { display: flex; justify-content: space-between; align-items: center; padding: 0 6px; }
.chapters-head h2 { font-size: 1.05rem; margin: 0; }
.chap-close { display: none; }
.chap-filter {
  width: 100%; font: inherit; font-size: .95rem; margin: 10px 0 8px; padding: 8px 12px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px;
}
.chap-empty { font-size: .9rem; color: var(--ink-2); padding: 0 6px; }
.paal { border-top: 1px solid var(--line); }
.paal:first-of-type { border-top: 0; }
.paal summary {
  cursor: pointer; padding: 10px 6px; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: baseline;
}
.paal summary::-webkit-details-marker { display: none; }
.paal summary::before { content: "+"; width: 1em; color: var(--ink-2); font-weight: 500; }
.paal[open] summary::before { content: "−"; }
.paal summary [lang="ta"] { color: var(--green); }
.paal-en { color: var(--ink-2); font-weight: 500; font-size: .92rem; }
.iyal { margin: 8px 6px 2px; font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.iyal [lang="ta"] { font-weight: 500; margin-right: 4px; }
.chap-list { list-style: none; margin: 0 0 4px; padding: 0; }
.chap-list a {
  display: grid; grid-template-columns: 2.1em 1fr; gap: 6px; align-items: baseline;
  padding: 5px 6px; border-radius: 7px; text-decoration: none; color: var(--ink);
}
.chap-list a:hover { background: var(--paper); }
.chap-list a[aria-current="page"] { background: var(--leaf); color: var(--leaf-ink); }
.chap-list a[aria-current="page"] .cnum, .chap-list a[aria-current="page"] .cen { color: var(--leaf-ink); }
.cnum { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .85rem; text-align: right; }
.cname { display: flex; flex-direction: column; line-height: 1.3; }
.cname [lang="ta"] { font-size: .98rem; }
.cen { font-size: .8rem; color: var(--ink-2); }

/* ---------- Chapter intro ---------- */
.crumbs { font-size: .9rem; color: var(--ink-2); margin-bottom: 6px; }
.crumbs a { color: var(--ink-2); }
.chapter-intro h1 { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.ch-no { font-size: 1rem; color: var(--green); font-weight: 600; }
.ch-ta { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 700; line-height: 1.2; }
.ch-en { font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 500; color: var(--ink-2); }
.ch-meta { color: var(--ink-2); font-size: .95rem; margin-bottom: 4px; }
.ch-when { font-family: var(--f-read); font-style: italic; font-size: 1.1rem; }

/* ---------- Toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  margin: 22px 0 26px; padding: 12px 16px; background: var(--green-soft); border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
}
.toolbar-title { margin: 0; font-weight: 600; color: var(--green); }
.toolbar label { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.toolbar select {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; max-width: min(62vw, 270px);
}

/* ---------- Kural ---------- */
.kural-list { display: flex; flex-direction: column; gap: 44px; }
.kural { scroll-margin-top: 150px; }
.kural-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.kural-head h3 { margin: 0; font-size: 1.05rem; }
.kural-head h3 a { color: var(--ink); text-decoration: none; }
.kural-head h3 a:hover { color: var(--accent); }
.kural-ch { font-size: .92rem; color: var(--ink-2); }
.kural-tools { margin-left: auto; display: flex; gap: 8px; }
.listen { display: inline-flex; align-items: center; gap: 6px; }
.listen, .copy { font: inherit; font-size: .85rem; color: var(--ink-2); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: var(--ink-2); }
.why { font-size: .88rem; color: var(--green); margin: -4px 0 10px; }

/* The palm leaf (ஓலைச்சுவடி) */
.leaf {
  position: relative; border-radius: var(--radius-leaf); color: var(--leaf-ink);
  padding: 22px 64px 22px 84px;
  background:
    repeating-linear-gradient(180deg, transparent 0 5px, rgba(120, 85, 30, .07) 5px 6px),
    linear-gradient(180deg, var(--leaf-hi), var(--leaf) 55%, #DCC283);
  box-shadow: inset 0 0 0 1px var(--leaf-edge), inset 0 -6px 12px -8px rgba(90, 60, 10, .35);
}
.leaf::before, .leaf::after {
  content: ""; position: absolute; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%;
  background: var(--paper); box-shadow: inset 0 1px 2px rgba(60, 40, 10, .45);
}
.leaf::before { left: 38px; }
.leaf::after { right: 30px; }
.leaf p, .leaf-text { margin: 0; display: flex; flex-direction: column; font-size: clamp(1.15rem, 2.1vw, 1.42rem); line-height: 1.75; font-weight: 500; }
.leaf p span:last-child, .leaf-text span:last-child { padding-left: 1.6em; }
.leaf-text {
  font-family: var(--f-ta); color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer;
  align-items: flex-start; border-radius: 6px;
}
.leaf-text:hover span { text-decoration: underline dotted rgba(60, 40, 10, .45); text-underline-offset: .3em; }
.leaf-src {
  position: absolute; right: 52px; bottom: 7px; font: italic 400 .72rem/1 var(--f-read); color: rgba(45, 31, 14, .62);
  text-decoration: none; letter-spacing: .01em;
}
.leaf-src:hover { color: var(--leaf-ink); text-decoration: underline; }
.is-speaking .leaf { box-shadow: inset 0 0 0 2px var(--green), inset 0 -6px 12px -8px rgba(90, 60, 10, .35); }
.is-speaking .leaf-text span { color: #183D2F; }
.is-target .leaf { box-shadow: inset 0 0 0 2px var(--accent), inset 0 -6px 12px -8px rgba(90, 60, 10, .35); }

.boxes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); gap: 12px; margin-top: 12px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px 12px; }
.box h4 { font-size: .85rem; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
.say-en { display: flex; flex-direction: column; font-weight: 500; font-size: 1.02rem; margin: 0; }
.mean { font-family: var(--f-read); font-size: 1.1rem; line-height: 1.55; margin-bottom: 8px; }
.pope summary { cursor: pointer; font-size: .88rem; color: var(--accent); }
.pope p { font-family: var(--f-read); font-style: italic; margin: 6px 0 0; }
.pope .by { font-style: normal; font-family: var(--f-ui); font-size: .82rem; color: var(--ink-2); }
.box-mine { grid-column: 1 / -1; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.box-mine h4 { color: var(--accent); }
.mine-say { display: flex; flex-direction: column; margin-bottom: 8px; font-size: 1.04rem; font-weight: 500; }
.mine-label { font-size: .8rem; color: var(--ink-2); font-weight: 500; }
.mine-say[lang="hi"], .mine-say[lang="ml"], .mine-say[lang="te"], .mine-say[lang="kn"], .mine-say[lang="th"] { font-family: "Noto Sans", "Noto Sans Devanagari", "Noto Sans Malayalam", "Noto Sans Telugu", "Noto Sans Kannada", "Noto Sans Thai", var(--f-ui); font-size: 1.12rem; }
.mine-mean { font-family: var(--f-read); font-size: 1.08rem; margin-bottom: 4px; }
.mine-mean[lang="ta"] { font-family: var(--f-ta); font-size: 1rem; }
.mine-mean.is-missing { font-family: var(--f-ui); font-size: .95rem; color: var(--ink-2); }
.mine-note { font-size: .85rem; color: var(--ink-2); margin: 0; }
.mine-note:empty { display: none; }

/* ---------- Pager ---------- */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; border-top: 1px solid var(--line); padding-top: 20px; }
.pager a { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); font-weight: 600; max-width: 48%; }
.pager a span { font-weight: 400; font-size: .88rem; color: var(--ink-2); }
.pager .next { text-align: right; margin-left: auto; }

/* ---------- Home ---------- */
.home-intro h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); max-width: 22ch; }
.home-intro h1 [lang="ta"] { display: block; font-size: .62em; color: var(--green); font-weight: 700; margin-bottom: 6px; }
.home-intro p { font-size: 1.12rem; max-width: 62ch; color: var(--ink-2); }
.today { margin-top: 36px; }
.today h2, .start h2, .books h2, .themes h2 { font-size: 1.2rem; }
.start { margin-top: 48px; }
.chips { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a {
  display: inline-block; text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: .95rem;
}
.chips a:hover { border-color: var(--green); color: var(--green); }
.books { margin-top: 48px; }
.book-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.book { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); padding: 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); border-top: 5px solid var(--leaf-edge); }
.book-2 { border-top-color: var(--green); }
.book-3 { border-top-color: var(--accent); }
.book-ta { font-size: 1.3rem; font-weight: 700; }
.book-en { font-weight: 600; }
.book-meta { font-size: .88rem; color: var(--ink-2); }
.book:hover { border-color: var(--ink-2); }

/* ---------- Search ---------- */
.search-intro h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.search-intro h1 q { color: var(--green); }
.search-intro p { max-width: 64ch; color: var(--ink-2); }
.themes { margin: 26px 0 8px; }
.theme-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.theme-list a { display: flex; gap: 10px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; height: 100%; }
.theme-list a:hover { border-color: var(--green); }
.theme-list .cnum { padding-top: 2px; }
.theme-when { display: block; font-size: .86rem; color: var(--ink-2); }
.disclaimer { margin-top: 32px; font-size: .9rem; color: var(--ink-2); }

/* ---------- About ---------- */
.about { max-width: 70ch; }
.about-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.lede { font-family: var(--f-read); font-size: 1.25rem; line-height: 1.5; }
.about section { margin-top: 40px; }
.about h2 { font-size: 1.35rem; color: var(--green); }
.about h3 { font-size: 1.1rem; margin-top: 1.4em; }
.about p, .about li, .about dd { font-family: var(--f-read); font-size: 1.08rem; line-height: 1.7; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px; margin-top: 24px; }
.toc ol { margin: 0; padding-left: 1.3em; columns: 2; column-gap: 32px; }
.toc li { font-size: .98rem; font-family: var(--f-ui); }
.books-dl { margin: 0; display: grid; gap: 14px; }
.books-dl div { border-left: 4px solid var(--leaf-edge); padding: 2px 0 2px 16px; }
.books-dl div:nth-child(2) { border-left-color: var(--green); }
.books-dl div:nth-child(3) { border-left-color: var(--accent); }
.books-dl dt { font-weight: 600; }
.books-dl dt [lang="ta"] { margin-right: 6px; }
.books-dl dd { margin: 4px 0 0; }
.sample { margin: 18px 0 20px; }
.sample figcaption { margin-top: 10px; font-size: .98rem; color: var(--ink-2); }
.sample .say-en { display: block; font-family: var(--f-ui); color: var(--ink); }
.howto { padding-left: 1.2em; }
.howto li { margin-bottom: .5em; }
.status { border-collapse: collapse; width: 100%; font-size: .95rem; }
.status th, .status td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.status td:last-child, .status th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.version { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.version h3 { margin-top: 0; }
.credit-block { margin-top: 20px; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 22px 24px 28px; text-align: center; }
.site-foot p { margin: 0 0 6px; }
.credit { font-size: .98rem; }
.foot-links { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: .9rem; }

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 22px 16px 40px; }
  .head-row, .ask { padding-left: 16px; padding-right: 16px; }
  .ask-suggest { left: 16px; right: 16px; }
  .head-row { flex-wrap: wrap; gap: 10px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .chap-toggle {
    display: inline-block; font: inherit; font-weight: 600; color: var(--green); background: var(--green-soft);
    border: 0; border-radius: 9px; padding: 7px 14px; cursor: pointer;
  }
  .chapters {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(88vw, 360px); max-height: none; border-radius: 0;
    z-index: 60; transform: translateX(105%); transition: transform .22s ease; border-width: 0 0 0 1px;
  }
  .chapters-open .chapters { transform: none; }
  .chap-close { display: inline-block; font: inherit; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; color: var(--ink); cursor: pointer; }
  .scrim { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 55; }
  .boxes { grid-template-columns: minmax(0, 1fr); }
  .book-row, .theme-list { grid-template-columns: minmax(0, 1fr); }
  .toc ol { columns: 1; }
}
@media (max-width: 560px) {
  .brand-sub { display: none; }
  .brand-ta { font-size: 1.45rem; }
  .ask-field { flex-direction: column; }
  .ask-label { font-size: .95rem; }
  .leaf { padding: 16px 30px 16px 44px; border-radius: 28px; }
  .leaf::before { left: 18px; }
  .leaf::after { right: 12px; }
  .leaf p span:last-child, .leaf-text span:last-child { padding-left: .8em; }
  .leaf { padding-bottom: 26px; }
  .leaf-src { right: 30px; bottom: 6px; font-size: .66rem; }
  .toolbar { position: static; }
  .toolbar label { width: 100%; justify-content: space-between; }
  .toolbar select { max-width: 70%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-head, .chapters, .toolbar, .copy, .pager, .site-foot .foot-links { display: none !important; }
  .layout { display: block; }
  .leaf { box-shadow: none; border: 1px solid #999; }
}

/* ---------- V1.1 ---------- */
.brand { align-items: center; }
.brand-portrait { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px var(--leaf-edge); }
.brand-text { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.listen { font: inherit; font-size: .85rem; color: var(--green); background: var(--green-soft); border: 1px solid transparent; border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.listen:hover { border-color: var(--green); }
.listen[aria-pressed="true"] { background: var(--green); color: #fff; }
.copy { font: inherit; font-size: .85rem; color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.say-status { font-size: .9rem; color: var(--ink-2); margin: 8px 4px 0; }

/* Sign-in and account menu */
.signin { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 10px; font-weight: 500; }
.signin:hover { border-color: var(--ink-2); }
.acct { position: relative; }
.acct summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); }
.acct summary::-webkit-details-marker { display: none; }
.acct-name { max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; font-size: .8rem; font-weight: 600; flex: none; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 18px 40px -18px rgba(20, 30, 40, .35); }
.acct-menu a, .acct-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; }
.acct-menu a:hover, .acct-menu button:hover { background: var(--paper); }
.acct-who { margin: 2px 10px 8px; font-weight: 600; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.acct-who span { font-weight: 400; font-size: .85rem; color: var(--ink-2); }

/* Comments */
.talk { margin-top: 10px; }
.talk-toggle { font: inherit; font-size: .95rem; color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; font-weight: 500; }
.talk-toggle::before { content: "+ "; }
.talk-toggle[aria-expanded="true"]::before { content: "− "; }
.talk-n { color: var(--ink-2); font-weight: 400; }
.talk-body { border-left: 3px solid var(--line); padding: 6px 0 6px 16px; margin-top: 6px; }
.cm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cm-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 4px; font-size: .9rem; }
.cm-head .avatar { width: 26px; height: 26px; font-size: .72rem; }
.cm-manager .avatar { background: var(--accent); }
.cm-kind, .cm-date { color: var(--ink-2); }
.cm-body { margin: 0; white-space: pre-line; font-family: var(--f-read); font-size: 1.04rem; }
.reply { margin-top: 8px; padding: 8px 12px; background: var(--green-soft); border-radius: 10px; }
.reply p { margin: 0; white-space: pre-line; }
.reply-by { font-size: .85rem; color: var(--green); font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; line-height: 1.5; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag-ok { background: var(--green-soft); color: var(--green); }
.tag-muted { background: var(--paper); color: var(--ink-2); }
.cm-form { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.cm-as { font-size: .9rem; color: var(--ink-2); margin-bottom: 8px; }
.cm-row { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.cm-form label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; margin-bottom: 8px; }
.cm-form select, .cm-form textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.cm-form textarea { resize: vertical; min-height: 4.5em; }
.cm-err { color: #B3261E; font-size: .9rem; margin: 0 0 6px; }
.cm-signin { margin: 12px 0 0; }
.btn-google { display: inline-flex; align-items: center; gap: 10px; background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; text-decoration: none; }
.btn-sm { padding: 7px 16px; border-radius: 9px; font-size: .95rem; }
.btn-quiet { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.link { font: inherit; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }
.btn { text-decoration: none; display: inline-block; }

/* Footer visitors */
.visits {
  margin: 14px auto 0; display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px;
  font: inherit; font-size: .82rem; color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; cursor: pointer;
}
.visits:hover { border-color: var(--ink-2); color: var(--ink); }
.visits-label { font-weight: 600; }
.visits-list { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
.visits b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.online b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2E8B57; margin-right: 5px; vertical-align: 1px; }
.spark { display: block; }
.spark-line { fill: none; stroke: var(--green); stroke-width: 1.6; stroke-linejoin: round; }
.spark-area { fill: var(--green-soft); }

.stats-dialog { width: min(920px, 94vw); max-height: 90vh; border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; background: var(--surface); color: var(--ink); }
.stats-dialog::backdrop { background: rgba(10, 14, 20, .5); }
.stats-head { display: flex; justify-content: space-between; align-items: center; }
.stats-close { font: inherit; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; color: var(--ink); cursor: pointer; }
.stats-more { margin: 16px 0 0; }
.stats-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 12px 0 18px; }
.stats-tiles p { margin: 0; background: var(--paper); border-radius: 10px; padding: 10px 12px; font-size: .88rem; color: var(--ink-2); }
.stats-tiles b { display: block; font-size: 1.5rem; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--ink-2); stroke-width: 1; }
.chart .axis { fill: var(--ink-2); font: 11px var(--f-ui); }
.chart .bar-fill { fill: var(--green); }
.chart .hit { fill: transparent; }
.chart .bar:hover .bar-fill { fill: var(--accent); }
.stats-note { font-size: .85rem; color: var(--ink-2); }
.stats-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.stats-cols h3, .stats-dialog h3, .stats-page h3 { font-size: 1rem; margin-top: 1em; }
.stats-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.stats-table th, .stats-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.stats-table td:not(:first-child), .stats-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.stats-data { margin-top: 16px; }
.stats-data summary { cursor: pointer; color: var(--accent); }

/* Wide pages: account, apply, dashboard, stats */
.layout-wide { grid-template-columns: minmax(0, 1fr); max-width: 1100px; }
.lede-sm { font-size: 1.08rem; color: var(--ink-2); max-width: 70ch; }
.empty { color: var(--ink-2); }
.notice { max-width: 60ch; }
.history { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 16px; }
.history-item, .mod-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.history-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .88rem; color: var(--ink-2); margin-bottom: 6px; }
.history-meta a { font-weight: 600; }
.history-body { font-family: var(--f-read); font-size: 1.05rem; margin-bottom: 6px; }
.panel-note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 14px 0; }
.panel-note.ok { border-color: var(--green); background: var(--green-soft); }
.panel-note.err { border-color: #B3261E; background: #FBEDEC; color: #5A1410; }
.panel-note h2 { font-size: 1.1rem; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; max-width: 760px; }
.form-card fieldset { border: 0; padding: 0; margin: 0 0 18px; }
.form-card legend { font-weight: 600; font-size: 1.1rem; margin-bottom: 8px; color: var(--green); }
.form-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; margin-bottom: 12px; }
.form-card .hint { font-weight: 400; font-size: .86rem; color: var(--ink-2); }
.form-card input:not([type=radio]):not([type=checkbox]), .form-card textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
}
.form-card .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-card .radios { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; margin-bottom: 10px; }
.form-card label.radio, .form-card label.check, .check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
.field-static { color: var(--ink-2); }
.actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.dash-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; }
.dash-tabs a { padding: 8px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.dash-tabs a[aria-current="page"] { color: var(--green); border-bottom-color: var(--green); }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 24px; }
.tile { display: block; text-decoration: none; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile b { display: block; font-size: 1.8rem; color: var(--ink); line-height: 1.2; }
.tile:hover { border-color: var(--green); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
.filters select, .filters input, .mod-reply textarea, .edit-grid textarea, .edit-grid select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
.mod-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.mod-item.is-hidden { opacity: .7; }
.mod-reply label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--ink-2); }
.mod-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 10px; flex-wrap: wrap; }
.mod-buttons { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: .92rem; }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; margin-bottom: 24px; }
.edit-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; margin: 10px 0; }
.edit-grid aside h2 { font-size: 1.05rem; }
.fb { border-bottom: 1px solid var(--line); padding: 8px 0; }
.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
.data th, .data td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ref { font-family: var(--f-read); }

/* About portrait */
.about-head::after { content: ""; display: block; clear: both; }
.portrait { float: right; width: min(260px, 42%); margin: 0 0 16px 24px; }
.portrait img { width: 100%; height: auto; display: block; }
.portrait figcaption { font-size: .86rem; color: var(--ink-2); margin-top: 8px; text-align: center; }
@media (max-width: 960px) {
  .edit-grid { grid-template-columns: minmax(0, 1fr); }
  .acct-name { display: none; }
  .signin span { display: none; }
}
@media (max-width: 560px) {
  .brand-portrait { width: 42px; height: 42px; }
  .portrait { float: none; width: 70%; margin: 0 auto 16px; }
  .form-card .two, .form-card .radios { grid-template-columns: 1fr; }
  .kural-tools { margin-left: 0; width: 100%; }
}
.cm-del { font-size: .85rem; margin-top: 4px; color: var(--ink-2); }
