/* SACCO website & administration portal stylesheet.
   Colours, radius, shadow and type scale come from theme tokens (CSS custom properties) that the
   active theme injects in <style id="theme-vars">. The fallbacks below equal the "heritage" theme so
   the page stays readable if the database is unavailable (installer, error pages). */

@font-face { font-family: "Noto Sans"; src: url("../fonts/NotoSans-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/NotoSans-Bold.woff2") format("woff2"); font-weight: 600 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans Ethiopic"; src: url("../fonts/NotoSansEthiopic-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+1200-139F, U+2D80-2DDF, U+AB00-AB2F; }
@font-face { font-family: "Noto Sans Ethiopic"; src: url("../fonts/NotoSansEthiopic-Bold.woff2") format("woff2"); font-weight: 600 800; font-display: swap; unicode-range: U+1200-139F, U+2D80-2DDF, U+AB00-AB2F; }

:root {
  --primary: #14532d; --primary-contrast: #fff; --accent: #f2c94c; --accent-contrast: #1f1a05;
  --bg: #f7f8f4; --surface: #fff; --surface-2: #eef3ea; --text: #1b241d; --muted: #4d5a50; --border: #d5ddd3;
  --link: #14532d; --header-bg: #14532d; --header-text: #fff; --footer-bg: #0f2e1b; --footer-text: #e9f1e6;
  --success: #1e7a3c; --warning: #8a5a00; --danger: #b42318; --radius: 10px; --shadow: 0 1px 3px rgba(0,0,0,.12);
  --font-scale: 1; --heading-weight: 700;
  --font: "Noto Sans", "Noto Sans Ethiopic", "Nyala", "Segoe UI", system-ui, -apple-system, sans-serif;
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem; --space-4: 1rem; --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem; --space-8: 4.5rem;
  --container: 1180px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; font-size: calc(100% * var(--font-scale)); scroll-padding-top: 5rem; }
body { margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.6; color: var(--text); background: var(--bg); text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
body.lang-am { line-height: 1.75; }
img, svg, video { max-width: 100%; height: auto; display: block; }
picture { display: block; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: var(--heading-weight); margin: 0 0 var(--space-3); text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); }
h3 { font-size: 1.15rem; }
h4, .h4 { font-size: 1rem; }
p { margin: 0 0 var(--space-4); }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
main:focus { outline: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }
code, .secret { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
address { font-style: normal; }
dl { margin: 0; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.break { overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
input.num { text-align: right; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--space-4); top: -100px; z-index: 100; background: var(--surface); color: var(--text); padding: var(--space-2) var(--space-4); border-radius: var(--radius); box-shadow: var(--shadow); }
.skip-link:focus { top: var(--space-2); }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--space-4); }
@media (min-width: 768px) { .container { padding: 0 var(--space-5); } }
.narrow { max-width: 760px; }
.narrow-prose, .prose-wide { max-width: 820px; }
.section { padding-top: var(--space-7); padding-bottom: var(--space-7); }
.section-alt { background: var(--surface-2); }
.section-head, .row-between { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.section-head h2 { margin: 0; }
.two-col { display: grid; gap: var(--space-6); }
.grid-2 { display: grid; gap: var(--space-5); }
.wide-left { display: grid; gap: var(--space-6); }
.two-col > *, .grid-2 > *, .wide-left > * { min-width: 0; }
@media (min-width: 900px) {
  .two-col, .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .wide-left { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.list-plain, .link-list, .footer-links, .social, .doc-list, .notif-list, .event-list, .product-list { list-style: none; margin: 0; padding: 0; }
.link-list li { padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.link-list li:last-child { border-bottom: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: .55rem 1.1rem; font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; color: var(--primary-contrast); background: var(--primary); border: 2px solid var(--primary); border-radius: var(--radius); cursor: pointer; transition: filter .15s, background .15s, color .15s; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-small { min-height: 36px; padding: .3rem .8rem; font-size: .9rem; }
.btn-block { width: 100%; }
.btn-accent { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--primary); border-color: currentColor; }
.btn-ghost:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); filter: none; }
.btn-ghost-dark { background: transparent; color: inherit; border-color: currentColor; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost.btn-danger { background: transparent; color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.actions, .form-actions, .hero-actions, .row-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.form-actions { margin-top: var(--space-5); }
.inline-form, .action-form { display: inline-flex; gap: var(--space-2); align-items: center; margin: 0; flex-wrap: wrap; }
.card .action-form { display: flex; align-items: flex-end; margin-bottom: var(--space-3); }
.card .action-form .field { flex: 1 1 200px; margin: 0; }
.card form + h2, .card form + h3 { margin-top: var(--space-5); }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border); padding: var(--space-3) var(--space-4); margin: var(--space-5) calc(var(--space-4) * -1) calc(var(--space-4) * -1); display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Header & navigation */
.setup-notice { background: var(--accent); color: var(--accent-contrast); font-size: .9rem; padding: var(--space-2) 0; }
.site-header { background: var(--header-bg); color: var(--header-text); border-bottom: 1px solid color-mix(in srgb, var(--header-text) 15%, transparent); position: sticky; top: 0; z-index: 40; }
.header-inner { display: flex; align-items: center; gap: var(--space-4); min-height: 68px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: var(--space-3); color: inherit; text-decoration: none; font-weight: 700; font-size: 1.1rem; margin-right: auto; padding: var(--space-2) 0; flex: 1 1 0; min-width: 0; }
.brand-name { line-height: 1.25; overflow-wrap: anywhere; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-logo img { height: 48px; width: auto; }
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: transparent; color: inherit; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); border-radius: var(--radius); cursor: pointer; }
.site-nav { display: none; width: 100%; padding-bottom: var(--space-4); }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { color: inherit; text-decoration: none; display: block; padding: .55rem .25rem; border-radius: 6px; }
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; }
.site-nav .sub { padding-left: var(--space-4); }
.site-nav .btn { color: var(--primary-contrast); display: inline-flex; }
.nav-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-3); }
.nav-actions .link-btn { color: inherit; }
.lang-switch { display: inline-flex; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); border-radius: 999px; overflow: hidden; }
.lang-switch a { padding: .25rem .75rem; font-size: .9rem; }
.lang-switch a.active { background: color-mix(in srgb, currentColor 18%, transparent); font-weight: 700; }
@media (min-width: 1024px) {
  .nav-toggle:not(.admin-toggle) { display: none; }
  .brand { flex: 0 1 auto; }
  .site-nav { display: flex !important; align-items: center; gap: var(--space-4); width: auto; padding: 0; }
  .site-nav > ul { display: flex; gap: var(--space-1); flex-wrap: wrap; }
  .site-nav > ul > li { position: relative; }
  .site-nav a { padding: .45rem .6rem; font-size: .95rem; }
  .site-nav .sub { display: none; position: absolute; top: 100%; left: 0; min-width: 220px; background: var(--surface); color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.15); border-radius: var(--radius); padding: var(--space-2); z-index: 50; }
  .site-nav .has-sub:hover .sub, .site-nav .has-sub:focus-within .sub { display: block; }
  .nav-actions { margin: 0; }
}

/* Hero & public sections */
.hero { position: relative; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000)); color: var(--primary-contrast); padding: var(--space-8) 0; overflow: hidden; }
.hero-media .hero-img { position: absolute; inset: 0; }
.hero-media .hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.72), rgba(0,0,0,.25)); }
.hero-media { color: #fff; }
.hero-inner { position: relative; z-index: 1; max-width: var(--container); }
.hero h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.2rem); max-width: 18ch; }
.hero .lead { max-width: 55ch; color: inherit; opacity: .95; }
.hero .btn-ghost { color: inherit; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: var(--space-2); }
.hero .eyebrow { color: inherit; opacity: .85; }
.lang-am .eyebrow { text-transform: none; letter-spacing: 0; }
.lead { font-size: 1.15rem; color: var(--muted); }
.page-head { padding: var(--space-6) 0 var(--space-5); background: var(--surface-2); border-bottom: 1px solid var(--border); margin-bottom: var(--space-6); }
.page-head h1 { margin-bottom: var(--space-2); }
.page-head .lead { margin: 0; }
.page-figure { margin: 0 0 var(--space-5); border-radius: var(--radius); overflow: hidden; }
.page-body { padding-bottom: var(--space-7); }
.quick-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.quick { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: transform .15s, border-color .15s; }
.quick:hover { transform: translateY(-2px); border-color: var(--primary); }
.quick span:last-child { color: var(--muted); font-size: .95rem; }
.quick-icon { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface-2); color: var(--primary); }
.quick-icon svg { width: 24px; height: 24px; }
.figure { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-bottom: var(--space-2); font-variant-numeric: tabular-nums; }
.figure small { font-size: .9rem; font-weight: 400; color: var(--muted); }
.post-item, .event-item { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.post-item:last-child, .event-item:last-child { border-bottom: 0; }
.date-chip { flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; padding: var(--space-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: .8rem; line-height: 1.2; text-align: center; }
.post-card { display: flex; flex-direction: column; }
.post-card picture, .post-card img { border-radius: calc(var(--radius) - 2px); margin-bottom: var(--space-3); aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.cta-band { background: var(--primary); color: var(--primary-contrast); padding: var(--space-7) 0; }
.cta-band a:not(.btn) { color: inherit; }
.cta-inner { display: flex; gap: var(--space-4); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cta-inline { padding: var(--space-5); background: var(--surface-2); border-radius: var(--radius); margin: var(--space-5) 0; }
.product-detail { margin-bottom: var(--space-5); scroll-margin-top: 6rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); margin: var(--space-3) 0; }
.facts > div, .facts dt, .facts dd { margin: 0; }
.facts dt { font-size: .85rem; color: var(--muted); }
.facts dd { font-weight: 600; }
.product-hints { font-size: .9rem; color: var(--muted); }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 var(--space-5); }
.steps li { counter-increment: step; position: relative; padding: 0 0 var(--space-4) 3rem; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2rem; height: 2rem; border-radius: 50%; background: var(--primary); color: var(--primary-contrast); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.person { text-align: center; }
.person img { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; margin: 0 auto var(--space-3); }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary { cursor: pointer; padding: var(--space-3) 0; font-weight: 600; list-style-position: inside; }
.faq-item > div { padding-bottom: var(--space-4); }
.gallery { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); }
.gallery figcaption { font-size: .9rem; color: var(--muted); margin-top: var(--space-1); }
.doc-list li, .doc { display: flex; justify-content: space-between; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card.doc { padding: var(--space-4); margin-bottom: var(--space-3); border: 1px solid var(--border); }
.branch { margin-bottom: var(--space-4); }
.map iframe { width: 100%; min-height: 320px; border: 0; border-radius: var(--radius); }
.disclaimer { font-size: .9rem; color: var(--muted); border-left: 4px solid var(--accent); padding: var(--space-2) var(--space-4); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }
.search-form { display: flex; gap: var(--space-2); margin-bottom: var(--space-5); flex-wrap: wrap; }
.search-form input { flex: 1 1 240px; }
.prose { max-width: 72ch; }
.prose img { border-radius: var(--radius); margin: var(--space-4) 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: var(--space-2); }
.empty, .empty-state { color: var(--muted); padding: var(--space-5); text-align: center; background: var(--surface-2); border-radius: var(--radius); border: 1px dashed var(--border); }
.empty-state h2 { color: var(--text); }
.verify-box { border: 1px dashed var(--warning); border-radius: var(--radius); padding: var(--space-3) var(--space-4); font-size: .92rem; }
.attention { border-left: 4px solid var(--warning); }

/* Footer */
.site-footer { background: var(--footer-bg); color: var(--footer-text); padding: var(--space-7) 0 var(--space-4); margin-top: var(--space-7); }
.site-footer a { color: inherit; }
.footer-grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.footer-name, .footer-head { font-weight: 700; font-size: 1.05rem; }
.footer-links li, .social li { padding: .2rem 0; }
.footer-search { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.footer-search input { flex: 1; min-width: 0; }
.footer-bottom { border-top: 1px solid color-mix(in srgb, var(--footer-text) 20%, transparent); margin-top: var(--space-6); padding-top: var(--space-4); font-size: .9rem; }
.muted-on-dark { opacity: .85; }
.site-footer .btn { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

/* Cards & content blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-5); margin-bottom: var(--space-5); }
.card > :last-child { margin-bottom: 0; }
.card h2 { font-size: 1.2rem; }
.card-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card-grid .card { margin: 0; }
.product h3 { margin-bottom: var(--space-2); }

/* Alerts & badges */
.flash-wrap { padding-top: var(--space-4); }
.admin .flash-wrap, .portal .flash-wrap { padding: 0; }
.alert { padding: var(--space-3) var(--space-4); border-radius: var(--radius); border: 1px solid; margin-bottom: var(--space-4); background: var(--surface); }
.alert-info { border-color: color-mix(in srgb, var(--link) 45%, transparent); background: color-mix(in srgb, var(--link) 7%, var(--surface)); }
.alert-success { border-color: var(--success); background: color-mix(in srgb, var(--success) 9%, var(--surface)); }
.alert-warn, .alert-warning { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, var(--surface)); }
.alert-error { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.alert > :last-child { margin-bottom: 0; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; background: var(--surface-2); color: var(--text); }
.badge-ok { color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--surface)); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.badge-warn { color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.badge-bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge-neutral { color: var(--muted); border-color: var(--border); }
.count { display: inline-block; min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; background: var(--accent); color: var(--accent-contrast); font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.4rem; }
.count-bad { background: var(--danger); color: #fff; }

/* Forms */
label { font-weight: 600; display: block; margin-bottom: var(--space-1); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid color-mix(in srgb, var(--text) 30%, var(--border)); border-radius: calc(var(--radius) * .6); padding: .55rem .7rem; min-height: 44px; width: 100%; max-width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; accent-color: var(--primary); }
input[type="color"] { width: 3rem; padding: .15rem; flex: none; }
input[type="file"] { padding: .4rem; }
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); margin: 0 0 var(--space-4); }
legend { font-weight: 700; padding: 0 var(--space-2); }
.field { margin-bottom: var(--space-4); min-width: 0; }
.field .help { font-size: .86rem; color: var(--muted); margin: var(--space-1) 0 0; }
.field-check { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.field-check label { margin: 0; font-weight: 500; order: 2; }
.field-check input { order: 1; }
.field-check .help, .field-check .field-error { order: 3; width: 100%; }
.req { color: var(--danger); }
.field-error { color: var(--danger); font-size: .88rem; margin: var(--space-1) 0 0; font-weight: 600; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.form-grid { display: grid; gap: 0 var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.one { grid-template-columns: 1fr; } }
@media (min-width: 900px) { .form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.form-grid .full, .form-grid fieldset, .form-grid .form-actions { grid-column: 1 / -1; }
.form-grid.compact .field { margin-bottom: var(--space-2); }
.narrow-form { max-width: 560px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: flex-end; margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-bar .field { margin: 0; flex: 1 1 160px; }
.filter-bar label { font-size: .85rem; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.filter-tabs a { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--text); background: var(--surface); font-size: .9rem; }
.filter-tabs a[aria-current], .filter-tabs a.active { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.org-form .org-field { border-bottom: 1px solid var(--border); padding: var(--space-4) 0; }
.lang-block { border-left: 3px solid var(--border); padding-left: var(--space-3); margin-bottom: var(--space-3); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

/* Tabs */
.tabs { margin-bottom: var(--space-4); }
nav.tabs, .tabs [role="tablist"] { display: flex; gap: var(--space-1); border-bottom: 2px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
nav.tabs a, .tabs [role="tab"] { padding: .6rem 1rem; white-space: nowrap; text-decoration: none; color: var(--muted); border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
nav.tabs a[aria-current="page"], .tabs [role="tab"][aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tabs [role="tabpanel"] { padding-top: var(--space-4); }

/* Tables */
.table-wrap { position: relative; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: var(--space-4); }
.card .table-wrap { border-radius: calc(var(--radius) * .6); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
.lang-am thead th { text-transform: none; letter-spacing: 0; font-size: .88rem; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
tfoot th, tfoot td { border-top: 2px solid var(--border); font-weight: 700; background: var(--surface-2); }
th.num, td.num { text-align: right; }
.row-header th { background: var(--surface-2); }
.row-muted { color: var(--muted); }
.unread { font-weight: 600; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.journal-lines td { padding: .35rem; }
.journal-lines select, .journal-lines input { min-width: 120px; }
.tr-table td { min-width: 200px; }
.tr-table textarea { min-height: 3rem; }
.pager { display: flex; gap: var(--space-2); align-items: center; justify-content: space-between; flex-wrap: wrap; margin: var(--space-4) 0; }
.pager a, .pager span { padding: .3rem .7rem; border: 1px solid var(--border); border-radius: calc(var(--radius) * .6); text-decoration: none; background: var(--surface); }

/* Meta lists */
.meta { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--space-2) var(--space-4); }
.meta dt { color: var(--muted); font-size: .92rem; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 900px) { .meta.two-col { grid-template-columns: max-content 1fr max-content 1fr; } }
@media (max-width: 520px) { .meta, .meta.two-col { grid-template-columns: 1fr; } .meta dd { margin-bottom: var(--space-2); } }

/* Admin shell */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { background: var(--header-bg); color: var(--header-text); width: 260px; flex: none; padding: var(--space-4) var(--space-3); overflow-y: auto; position: fixed; inset: 0 auto 0 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
.admin-side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
.admin-brand { display: block; font-weight: 700; color: inherit; text-decoration: none; padding: var(--space-2) var(--space-3) var(--space-4); font-size: 1.05rem; line-height: 1.3; }
.admin-side ul { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.admin-side a { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); color: inherit; text-decoration: none; padding: .4rem var(--space-3); border-radius: 6px; font-size: .93rem; opacity: .92; }
.admin-side a:hover { background: color-mix(in srgb, currentColor 12%, transparent); opacity: 1; }
.admin-side a[aria-current="page"] { background: color-mix(in srgb, currentColor 18%, transparent); font-weight: 700; opacity: 1; box-shadow: inset 3px 0 0 var(--accent); }
.nav-group { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; margin: var(--space-3) var(--space-3) var(--space-1); font-weight: 700; }
.lang-am .nav-group { text-transform: none; letter-spacing: 0; font-size: .85rem; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; min-height: 56px; }
.admin-toggle { color: var(--text); border-color: var(--border); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.top-link { color: var(--text); text-decoration: none; font-size: .93rem; }
.top-link:hover { text-decoration: underline; }
.user-menu { position: relative; }
.user-menu summary { cursor: pointer; font-weight: 600; font-size: .93rem; list-style: none; padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: var(--space-2); min-width: 220px; z-index: 70; }
.menu-pop a, .menu-pop .link-btn { display: block; padding: .45rem .6rem; color: var(--text); text-decoration: none; width: 100%; text-align: left; }
.menu-pop form { margin: 0; }
.admin-content { padding: var(--space-5) var(--space-4) var(--space-7); max-width: 1400px; width: 100%; }
@media (min-width: 1100px) {
  .admin-side { position: sticky; top: 0; height: 100vh; transform: none; }
  .admin-toggle { display: none; }
  .admin-content { padding: var(--space-6); }
}
@media (max-width: 600px) { .top-link:first-of-type { display: none; } }
.page-title { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-title h1 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); margin: 0; }
.page-title p { margin: 0; flex-basis: 100%; }

/* Dashboard stats */
.stat-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: var(--space-5); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: var(--space-1); text-decoration: none; color: var(--text); }
a.stat:hover { border-color: var(--primary); }
.stat-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { font-size: .85rem; color: var(--muted); }
.stat-alert { border-left: 4px solid var(--danger); }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { padding: var(--space-2) 0; border-bottom: 1px solid var(--border); font-size: .93rem; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: var(--space-2) 0 var(--space-2) 2rem; position: relative; border-bottom: 1px solid var(--border); }
.checklist li::before { content: "○"; position: absolute; left: .3rem; color: var(--muted); font-weight: 700; }
.checklist li.done::before, .checklist li.ok::before { content: "✓"; color: var(--success); }
.checklist li.fail::before, .checklist li.bad::before { content: "✕"; color: var(--danger); }
.checklist li.warn::before { content: "!"; color: var(--warning); }
.log-row { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.message { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-3); background: var(--surface); }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Media library */
.media-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.media-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.media-tile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--surface-2); }
.media-placeholder { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); font-size: .85rem; padding: var(--space-2); text-align: center; }
.media-name { font-size: .85rem; padding: var(--space-2) var(--space-3); overflow-wrap: anywhere; }
.media-preview img { max-height: 420px; width: auto; border-radius: var(--radius); }

/* Auth & minimal pages */
.minimal-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-5) var(--space-4); }
.auth-wrap { width: 100%; display: flex; justify-content: center; padding: var(--space-6) var(--space-4); }
.auth-card, .setup-card, .success-card { width: 100%; max-width: 460px; }
.setup-card { max-width: 760px; }
.success-card { text-align: center; max-width: 620px; margin: var(--space-6) auto; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--primary); margin: 0; line-height: 1; }
.portal-main { padding-top: var(--space-5); padding-bottom: var(--space-7); }

/* Themes */
.theme-card { display: flex; flex-direction: column; gap: var(--space-3); }
.theme-card.is-active { outline: 3px solid var(--primary); outline-offset: 2px; }
.theme-swatch { display: flex; height: 44px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.theme-swatch span { flex: 1; }
.theme-live { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: calc(.95rem * var(--font-scale)); position: sticky; top: 72px; }
.tl-header { background: var(--header-bg); color: var(--header-text); padding: var(--space-3) var(--space-4); font-weight: 700; }
.tl-body { padding: var(--space-4); }
.tl-body h3 { font-weight: var(--heading-weight); color: var(--text); }
.tl-body a { color: var(--link); }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-3); margin: var(--space-3) 0; }
.tl-muted { color: var(--muted); }
.tl-btn { display: inline-block; background: var(--primary); color: var(--primary-contrast); border-radius: var(--radius); padding: .4rem .9rem; font-weight: 600; margin: 0 var(--space-2) var(--space-2) 0; }
.tl-accent { display: inline-block; background: var(--accent); color: var(--accent-contrast); border-radius: var(--radius); padding: .4rem .9rem; font-weight: 600; margin: 0 var(--space-2) var(--space-2) 0; }
.tl-ok { color: var(--success); font-weight: 600; }
.tl-warn { color: var(--warning); font-weight: 600; }
.tl-bad { color: var(--danger); font-weight: 600; }
.tl-footer { background: var(--footer-bg); color: var(--footer-text); padding: var(--space-3) var(--space-4); font-size: .9rem; }

/* Printable documents (receipts, statements, reports) */
.print-doc { background: #fff; color: #000; }
.print-actions { display: flex; gap: var(--space-2); justify-content: center; padding: var(--space-3); background: #f2f2f2; border-bottom: 1px solid #ccc; }
.print-page { max-width: 820px; margin: 0 auto; padding: var(--space-6) var(--space-5); }
.doc-head { display: flex; justify-content: space-between; gap: var(--space-4); align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.doc-head img { max-height: 64px; width: auto; }
.doc-title { font-size: 1.4rem; margin: var(--space-3) 0; text-transform: uppercase; letter-spacing: .05em; }
.lang-am .doc-title { text-transform: none; letter-spacing: 0; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: var(--space-4); }
.doc-table th, .doc-table td { border: 1px solid #555; padding: .35rem .5rem; color: #000; background: #fff; }
.doc-table thead th { background: #eee; color: #000; }
.signatures { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-6); margin-top: var(--space-7); }
.sig-line { border-top: 1px solid #000; padding-top: var(--space-1); font-size: .9rem; }
.stamp-reversed { display: inline-block; border: 3px solid #b42318; color: #b42318; font-weight: 800; padding: .2rem .8rem; transform: rotate(-6deg); text-transform: uppercase; letter-spacing: .1em; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .no-print, .print-actions, .site-header, .site-footer, .admin-side, .admin-top, .skip-link, .setup-notice, .actions, .filter-bar, .pager, .nav-toggle { display: none !important; }
  .print-page, .admin-content { padding: 0; max-width: none; }
  .card, .table-wrap { box-shadow: none; border-color: #999; }
  a { color: #000; text-decoration: none; }
  thead { display: table-header-group; }
  tr, .signatures { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
