:root{--navy:#0b1f4a;--navy-2:#13306b;--gold:#f5b81b;--green:#138808;--saffron:#ff9933;--ink:#17203a;--muted:#566079;--bg:#f6f7fb;--card:#fff;--line:#e3e6ef;--bad:#b91c1c}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;color:var(--ink);background:var(--bg);line-height:1.55}
body.modal-open{overflow:hidden}
a{color:var(--navy-2)}
img{max-width:100%}
h1{font-size:clamp(1.45rem,3vw,2rem);color:var(--navy);margin:0;line-height:1.2}
h2{font-size:1.15rem;color:var(--navy);margin:24px 0 12px}
h3{margin:0;font-size:1.05rem;color:var(--navy)}
.wrap{max-width:1120px;margin:0 auto;padding:0 16px;width:100%}
.wrap.narrow{max-width:760px}
main.wrap{padding-top:22px;padding-bottom:48px;min-height:70vh}
.boot{text-align:center;padding:60px 16px;color:var(--muted)}
.muted{color:var(--muted)}.muted-light{color:#b8c5e8}.small{font-size:.86rem}.center{text-align:center}.pre{white-space:pre-wrap;overflow-wrap:anywhere}
.grow{flex:1;min-width:0}
.clip{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* forms and buttons */
label{display:block;font-weight:600;font-size:.88rem;margin:0 0 12px;color:var(--navy)}
input,select,textarea{display:block;width:100%;margin-top:5px;padding:11px 12px;border:1px solid #cbd2e1;border-radius:10px;font:inherit;font-weight:400;background:#fff;color:var(--ink)}
input:focus,select:focus,textarea:focus{outline:2px solid var(--navy-2);outline-offset:0}
input:disabled{background:#eef1f7;color:var(--muted)}
button{font:inherit;cursor:pointer}
button:disabled{opacity:.6;cursor:default}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 20px;border-radius:10px;border:2px solid var(--navy);background:var(--navy);color:#fff;font-weight:700;text-decoration:none}
.btn.ghost{background:transparent;color:var(--navy)}
.btn.ghost.light{color:#fff;border-color:#ffffff66}
.btn.danger{background:var(--bad);border-color:var(--bad);color:#fff}
.btn.call{background:var(--green);border-color:var(--green);padding:8px 14px;font-size:.9rem}
.btn.block{display:flex;width:100%;margin-top:10px}
.link{background:none;border:0;padding:4px 6px;color:var(--navy-2);text-decoration:underline}
.link.strong{font-weight:800}.link.right{display:block;margin:-6px 0 6px auto}.link.muted{color:var(--muted)}
.danger-text{color:var(--bad)}
.plain{background:none;border:0;padding:0;text-align:left;color:inherit;display:block}
.icon-btn{background:none;border:0;font-size:1.1rem;padding:6px 10px;border-radius:8px;color:inherit}
.icon-btn:hover{background:#0000000d}
.actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap;margin-top:16px}
.with-btn{display:flex;align-items:center;gap:6px}
.chip{display:inline-block;padding:6px 14px;border-radius:999px;border:1px solid var(--line);background:#fff;font-size:.84rem;font-weight:700;color:var(--ink)}
.chip.on,.chip.dark{background:var(--navy);color:#fff;border-color:var(--navy)}
.chip.danger{background:#fee2e2;color:var(--bad);border-color:#fecaca}
.chip.live{background:#bbf7d0;color:#064e1c;border-color:#86efac}

/* shell */
.topbar{background:var(--navy);color:#fff;border-top:4px solid var(--saffron);position:sticky;top:0;z-index:20;box-shadow:0 2px 10px #0003}
.topbar>.wrap{display:flex;align-items:center;gap:12px;padding-top:8px;padding-bottom:8px}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:#fff;margin-right:auto;min-width:0}
.brand img{width:44px;height:44px;border-radius:10px;background:#fff}
.brand b{display:block;letter-spacing:.1em}
.brand small{display:block;font-size:.7rem;color:#cfd9f6;line-height:1.25}
.bell{position:relative;text-decoration:none;font-size:1.35rem;padding:4px 8px}
.bell span{position:absolute;top:0;right:0;background:#dc2626;color:#fff;font-size:.68rem;font-weight:800;border-radius:999px;min-width:18px;text-align:center;padding:0 4px}
.menu-btn{display:none;background:#ffffff1c;border:1px solid #ffffff40;color:#fff;border-radius:8px;padding:6px 12px}
.topbar nav{background:var(--navy-2)}
.topbar nav .wrap{display:flex;flex-wrap:wrap;gap:2px;padding-top:6px;padding-bottom:6px}
.topbar nav a{color:#e9eefc;text-decoration:none;padding:7px 11px;border-radius:8px;font-weight:600;font-size:.9rem}
.topbar nav a:hover,.topbar nav a.on{background:#ffffff1f;color:var(--gold)}
.topbar nav .link{color:#fecaca;margin-left:auto}
footer{background:var(--navy);color:#cfd9f6;font-size:.86rem;padding:18px 0}
footer .wrap{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
footer a{color:#fff}
.page-head{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;flex-wrap:wrap;margin-bottom:18px}
.page-head p{margin:4px 0 0;color:var(--muted)}
.back{font-size:.88rem;text-decoration:none}
.section-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px}

/* sign in and onboarding */
.split{display:grid;grid-template-columns:1fr 1.1fr;min-height:100vh}
.split aside{background:linear-gradient(160deg,var(--navy),var(--navy-2));color:#fff;padding:48px;display:flex;flex-direction:column;justify-content:center;border-top:4px solid var(--saffron)}
.split aside h1{color:#fff;margin:36px 0 8px;font-size:2.4rem}
.split aside .brand{margin:0}
.motto{letter-spacing:.2em;font-size:.76rem;color:#8fa1d3;margin-top:36px}
.split main{display:flex;align-items:center;justify-content:center;padding:32px 16px}
.split .panel{width:100%;max-width:440px}
.big-icon{font-size:3rem}
.spam{background:#fff7e0;border:2px solid #f59e0b;border-radius:12px;padding:12px 14px;margin:12px 0;text-align:left;color:#1f2937}
.spam strong{color:#7c2d12}.spam p{margin:8px 0 0;font-size:.88rem}
.steps{display:flex;justify-content:center;gap:28px;list-style:none;padding:0;margin:18px 0}
.steps li{display:flex;flex-direction:column;align-items:center;gap:4px;font-size:.82rem;color:var(--muted)}
.steps li span{width:34px;height:34px;border-radius:50%;background:#e2e6f0;display:grid;place-items:center;font-weight:800}
.steps li.on span{background:var(--navy);color:#fff}.steps li.done span{background:var(--green);color:#fff}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}
.row-btn{display:flex;gap:10px;align-items:flex-end}
.row-btn label{flex:1}.row-btn .btn{margin-bottom:12px}
.review{display:grid;grid-template-columns:minmax(120px,200px) 1fr;margin:0}
.review dt,.review dd{padding:9px 0;margin:0;border-bottom:1px solid var(--line)}
.review dt{color:var(--muted);font-size:.88rem}.review dd{font-weight:700;overflow-wrap:anywhere}
.bill{background:linear-gradient(150deg,var(--navy),#263248);color:#fff;border-radius:16px;padding:20px;margin-bottom:10px}
.bill h2{color:#fff;margin:0 0 6px}.bill p{margin:2px 0;font-size:.8rem;color:#cbd5e1}.bill .gold{color:var(--gold);font-weight:700}
.bill div{display:flex;justify-content:space-between;padding:6px 0}
.bill .total{border-top:1px solid #ffffff33;margin-top:8px;font-size:1.15rem}.bill .total b{color:#86efac;font-size:1.5rem}
.ready{list-style:none;padding:0}.ready li{margin-bottom:10px}.ready span{display:block;color:var(--muted);font-size:.84rem;padding-left:26px}

/* cards and lists */
.panel{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:22px;box-shadow:0 1px 3px #0b1f4a0d}
.panel h2:first-child{margin-top:0}
.card{display:block;background:var(--card);border:1px solid var(--line);border-radius:14px;padding:14px 16px;text-decoration:none;color:inherit;text-align:left;box-shadow:0 1px 3px #0b1f4a0d}
a.card:hover,button.card:hover{border-color:var(--navy-2)}
.card.row{display:flex;align-items:center;gap:12px;margin:0}
.card.block{width:100%}
.card b,.card small{display:block}
.row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.row.top{align-items:flex-start;flex-wrap:nowrap}
.card.row{flex-wrap:nowrap}
.card.unread{background:#e8f1ff;border-color:#bfd7ff}
.stack{display:flex;flex-direction:column;gap:10px}
.cols{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,360px),1fr));gap:14px;align-items:start}
.badge-icon{font-size:1.4rem;background:#fff6dc;border-radius:10px;padding:6px 10px}
.thumb{width:46px;height:46px;object-fit:cover;border-radius:8px}
.cover{width:100%;height:170px;object-fit:cover;border-radius:10px;margin:8px 0}
.empty{display:flex;flex-direction:column;align-items:center;gap:4px;padding:48px 16px;text-align:center;color:var(--muted)}
.empty-icon{font-size:3rem;opacity:.6}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:16px}
.toolbar input{flex:1;min-width:220px;margin:0}
.tabs{display:flex;gap:4px;border-bottom:2px solid var(--line);margin-bottom:18px}
.tabs a,.tabs button{padding:10px 16px;border:0;background:none;font-weight:700;color:var(--muted);text-decoration:none;border-bottom:3px solid transparent;margin-bottom:-2px}
.tabs .on{color:var(--navy);border-bottom-color:var(--navy)}
.alert{display:flex;flex-direction:column;gap:2px;border-radius:12px;padding:14px 16px;margin-bottom:14px;background:#fee2e2;color:#7f1d1d}
.alert.warn{background:#fff7e0;color:#7c4a03}.alert.info{background:#eef0ff;color:#27348b}

/* home */
.welcome{display:flex;justify-content:space-between;align-items:center;gap:14px;border-radius:20px;padding:22px 24px;background:linear-gradient(135deg,#ff9933 5%,#fff 50%,#138808 95%);box-shadow:0 4px 12px #0001}
.welcome h1{color:#111;margin:2px 0 8px}.welcome small{font-weight:700;color:#333}
.avatar{width:72px;height:72px;border-radius:50%;object-fit:cover;background:var(--navy);color:#fff;display:grid;place-items:center;font-size:1.8rem;flex:none;border:3px solid #fff;box-shadow:0 2px 6px #0002}
.avatar.small{width:46px;height:46px;font-size:1.1rem}.avatar.large{width:140px;height:140px;font-size:3.4rem;margin:0 auto}
.count{background:#fff1e0;border:1px solid #fdba74;border-radius:12px;text-align:center;padding:10px;color:#7c2d12;font-weight:600}
.banner{position:relative;margin-top:16px;border-radius:16px;overflow:hidden;background:#e5e7eb;aspect-ratio:16/6}
.banner>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.banner p{position:absolute;left:0;right:0;bottom:0;margin:0;padding:26px 14px 12px;color:#fff;font-weight:700;background:linear-gradient(transparent,#000c)}
.banner.placeholder{display:grid;place-items:center;background:#ffecb3;color:#7a5200;font-weight:700;aspect-ratio:16/4}
.dots{position:absolute;top:10px;right:10px;display:flex;gap:5px}
.dots button{width:10px;height:10px;border-radius:50%;border:0;padding:0;background:#ffffff80}.dots button.on{background:#fff}
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px}
.tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-height:116px;padding:14px;border-radius:16px;color:#fff;text-decoration:none;font-weight:700;text-align:center;text-shadow:0 1px 2px #0005;box-shadow:0 4px 10px #0002}
.tile span{font-size:1.9rem;background:#ffffff33;border-radius:50%;width:54px;height:54px;display:grid;place-items:center}
.tile:hover{filter:brightness(1.07);transform:translateY(-2px)}
.tile.indigo{background:linear-gradient(135deg,#5c6bc0,#303f9f)}.tile.green{background:linear-gradient(135deg,#66bb6a,#2e7d32)}
.tile.teal{background:linear-gradient(135deg,#26a69a,#00695c)}.tile.purple{background:linear-gradient(135deg,#ab47bc,#6a1b9a)}
.tile.red{background:linear-gradient(135deg,#ff5252,#c62828)}.tile.pink{background:linear-gradient(135deg,#ec407a,#ad1457)}
.tile.blue{background:linear-gradient(135deg,#42a5f5,#1565c0)}.tile.cyan{background:linear-gradient(135deg,#26c6da,#00838f)}
.tile.brown{background:linear-gradient(135deg,#8d6e63,#4e342e)}

/* directory, events, knowledge, media */
.people{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:14px}
.people .card{display:flex;flex-direction:column;align-items:center;gap:6px}
.datebox{background:#fdf0f5;border:1px solid #f8bbd0;color:#c2185b;border-radius:12px;width:62px;flex:none;text-align:center;padding:8px 0}
.datebox b{font-size:1.3rem}
.folders{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:12px;margin-bottom:16px}
.folder span{font-size:2rem}
.notice{border-left:6px solid #3b82f6}.notice.urgent{border-left-color:#ef4444}
.notice em{font-style:normal;font-size:.66rem;background:#dc2626;color:#fff;border-radius:4px;padding:2px 6px}
.notice span.clamp{margin-top:6px;color:var(--muted);font-size:.92rem}
.notice .view{float:right;color:var(--navy-2);font-weight:700}
.big{font-size:1.6rem;margin:16px 0}
.label{font-size:.76rem;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:18px 0 10px}
.attachment{border-radius:12px;border:1px solid var(--line);max-height:520px}
.gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:14px}
.media .frame{display:grid;place-items:center;aspect-ratio:4/3;background:#e9e7f5;border-radius:10px;overflow:hidden;margin-bottom:8px}
.media .frame img{width:100%;height:100%;object-fit:cover}
.play{font-size:2.6rem;color:#5b21b6}

/* elections */
.election{background:#fff;border:1px solid var(--line);border-radius:18px;overflow:hidden}
.election header{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:14px 16px;background:var(--navy);color:#fff}
.election header h3{color:inherit}.election header.ended{background:#eef0f4;color:var(--ink)}
.election-body{padding:16px;display:flex;flex-direction:column;gap:10px}
.state{display:flex;flex-direction:column;align-items:center;text-align:center;gap:4px;background:#f1f3f7;border-radius:12px;padding:20px}
.state.good{background:#e8f7ec;color:#14532d}

/* chat */
.chat{display:flex;flex-direction:column;height:min(68vh,640px);padding:0;overflow:hidden}
.messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:8px;background:#f8fafc}
.bubble{max-width:75%;padding:10px 14px;border-radius:16px}
.bubble small{display:block;font-size:.68rem;opacity:.7}
.bubble.me{align-self:flex-end;background:var(--navy);color:#fff;border-bottom-right-radius:3px}
.bubble.them{align-self:flex-start;background:#fff;border:1px solid var(--line);border-bottom-left-radius:3px}
.chat form{display:flex;gap:8px;padding:12px;border-top:1px solid var(--line)}
.chat input{margin:0}

/* profile and membership card */
.profile{display:grid;grid-template-columns:300px 1fr;gap:18px;align-items:start}
.signature{max-height:60px;margin:8px auto 0;display:block}
.print-area{display:flex;flex-wrap:wrap;gap:24px;justify-content:center}
.print-area figure{margin:0;width:min(100%,460px);container-type:inline-size}
.print-area figcaption{font-size:.8rem;color:var(--muted);text-align:center;margin-bottom:6px}
.idcard{position:relative;width:100%;aspect-ratio:400/305;background:#fff;color:#000;border:1px solid #000;border-radius:14px;overflow:hidden;display:flex;flex-direction:column;padding:2.6cqw 3cqw 2cqw;font-size:2.55cqw;line-height:1.3;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.idcard>*{position:relative}
.idcard .watermark{position:absolute;width:35%;left:32.5%;top:27%;opacity:.07}
.idhead{display:flex;gap:2cqw;align-items:center}
.idhead img{width:10.5cqw;height:10.5cqw}
.idhead div{flex:1;background:#0d47a1;color:#fff;text-align:center;font-weight:700;padding:1.2cqw 2cqw;font-size:2.6cqw}
.idtitle{text-align:center;font-weight:800;margin:1.2cqw 0;font-size:2.9cqw}
.idbody{display:flex;gap:2cqw;flex:1;min-height:0}
.idbody dl{flex:1;display:grid;grid-template-columns:23cqw 1fr;align-content:space-evenly;margin:0;min-width:0}
.idbody dt::after{content:" :"}
.idbody dd{margin:0;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.idphoto{width:22cqw;text-align:center}
.idphoto div{height:27cqw;border:2px solid #000;display:grid;place-items:center;overflow:hidden;background:#f3f4f6}
.idphoto img{width:100%;height:100%;object-fit:cover}
.idphoto small{display:block;font-weight:800;font-size:1.9cqw;margin-top:1cqw}
.idsigns{display:flex;justify-content:space-between;align-items:flex-end;text-align:center}
.idsigns div{width:23cqw}
.idsigns span{display:flex;justify-content:center;height:6.5cqw;border-bottom:1px solid #000}
.idsigns img{height:100%;object-fit:contain}
.idsigns b,.idsigns small{display:block;font-size:2.2cqw}
.idsigns small{font-size:1.8cqw}
.idcard.back{padding:3.5cqw;font-size:2.4cqw}
.idcard.back .idtitle{color:#0d47a1;font-size:2.5cqw}
.idcard.back ul{padding-left:4cqw;margin:1cqw 0 auto}
.idcard.back b{color:#0d47a1}
.idcard.back p{margin:.4cqw 0 0}
.idaddress{border-bottom:1px solid #bbb;padding-bottom:1.5cqw;margin-bottom:1.5cqw}

/* dialogs, viewers, messages */
.overlay{position:fixed;inset:0;background:#0b1220b3;z-index:50;display:flex;align-items:center;justify-content:center;padding:16px}
.modal{background:#fff;border-radius:16px;width:100%;max-width:480px;max-height:92vh;display:flex;flex-direction:column}
.modal.wide{max-width:960px}
.modal-head{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid var(--line)}
.modal-body{padding:16px 18px;overflow:auto}
.viewer{user-select:none;text-align:center}
.viewer img,.viewer video{max-width:100%;max-height:75vh;border-radius:8px}
.pdf-pages canvas{display:block;width:100%;margin:0 auto 10px;border:1px solid var(--line)}
.crop{text-align:center}
.crop-stage{position:relative;display:inline-block;overflow:hidden;touch-action:none;line-height:0}
.crop-stage img{max-width:100%;max-height:48vh;user-select:none}
.crop-box{position:absolute;border:2px solid #fff;box-shadow:0 0 0 2000px #0008;cursor:move;touch-action:none}
.crop-handle{position:absolute;right:0;bottom:0;width:26px;height:26px;border-radius:50%;background:var(--gold);border:2px solid #fff;cursor:nwse-resize}
.spinner{width:30px;height:30px;border-radius:50%;border:3px solid #cbd2e1;border-top-color:var(--navy);animation:spin .8s linear infinite;margin:28px auto}
.btn .spinner{width:20px;height:20px;margin:0}
@keyframes spin{to{transform:rotate(360deg)}}
#toasts{position:fixed;left:16px;right:16px;bottom:16px;z-index:100;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none}
.toast{background:#1f2937;color:#fff;padding:12px 16px;border-radius:10px;max-width:520px;white-space:pre-wrap;box-shadow:0 6px 20px #0004}
.toast.good{background:#15803d}.toast.bad{background:#b91c1c}

@media(max-width:860px){
  .split{grid-template-columns:1fr}.split aside{padding:22px 18px}.split aside h1{margin-top:14px;font-size:1.6rem}.motto{display:none}
  .menu-btn{display:block}
  .topbar nav{display:none}.topbar nav.open{display:block}
  .topbar nav .wrap{flex-direction:column}.topbar nav .link{margin:0;text-align:left;padding:7px 11px}
  .brand small{display:none}
  .profile{grid-template-columns:1fr}
}
@media(max-width:560px){
  .grid2{grid-template-columns:1fr}
  .tiles{grid-template-columns:repeat(3,1fr);gap:8px}.tile{min-height:100px;font-size:.8rem;padding:8px}
  .banner{aspect-ratio:16/9}
  .review{grid-template-columns:120px 1fr}
}
@media(prefers-reduced-motion:reduce){.tile:hover{transform:none}}

/* Printing: only the membership card, both sides on one A4 page. */
@page{size:A4;margin:14mm}
@media print{
  body{background:#fff}
  body *{visibility:hidden}
  .print-area,.print-area *{visibility:visible}
  .topbar,footer,.page-head,main>p{display:none}
  main.wrap{padding:0;min-height:0}
  .print-area{flex-direction:column;align-items:center;gap:12mm}
  .print-area figure{width:140mm;break-inside:avoid}
}
