*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:#f5f4f0;color:#1a1a18;min-height:100vh;display:flex;flex-direction:column;font-size:14px;}
.app-header{background:#fff;border-bottom:0.5px solid rgba(0,0,0,0.12);padding:0 20px;display:flex;align-items:center;justify-content:space-between;height:52px;position:sticky;top:0;z-index:100;flex-shrink:0;}
.app-title{font-size:14px;font-weight:500;}
.nav-tabs{display:flex;gap:2px;margin-left:16px;}
.nav-tab{padding:6px 14px;border-radius:6px;border:none;background:transparent;cursor:pointer;font-size:13px;color:#5f5e5a;position:relative;}
.nav-tab:hover{background:#f1efe8;color:#1a1a18;}
.nav-tab.active{background:#f1efe8;color:#1a1a18;font-weight:500;}
.warn-dot{position:absolute;top:5px;right:5px;width:7px;height:7px;border-radius:50%;background:#a32d2d;display:none;}
.warn-dot.on{display:block;}
.stage-badge{font-size:11px;font-weight:500;padding:3px 10px;border-radius:99px;border:0.5px solid rgba(0,0,0,0.12);white-space:nowrap;background:#f1efe8;color:#5f5e5a;display:none;}
.stage-badge.s1{background:#e1f5ee;color:#0f6e56;border-color:rgba(15,110,86,0.2);}
.stage-badge.s2{background:#faeeda;color:#854f0b;border-color:rgba(133,79,11,0.2);}
.stage-badge.s3{background:#eaf3de;color:#3b6d11;border-color:rgba(59,109,17,0.2);}
.stage-badge.mi{background:#fcebeb;color:#a32d2d;border-color:rgba(163,45,45,0.2);}
.main{flex:1;display:flex;flex-direction:column;max-width:900px;width:100%;margin:0 auto;}
.tab-panel{display:none;flex-direction:column;flex:1;}
.tab-panel.active{display:flex;}

/* Form elements */
.aform{padding:24px 20px;display:flex;flex-direction:column;gap:16px;}
.flabel{font-size:11px;font-weight:500;color:#5f5e5a;margin-bottom:5px;display:block;letter-spacing:.04em;text-transform:uppercase;}
.fhint{font-size:12px;color:#888780;margin-bottom:6px;display:block;}
.top-row{display:flex;gap:12px;}
.top-row .assoc-wrap{flex:1;}
.top-row .xn-wrap{width:160px;}
select,input[type=text],input[type=email],input[type=month]{width:100%;padding:9px 12px;border:0.5px solid rgba(0,0,0,0.18);border-radius:8px;font-size:14px;background:#fff;color:#1a1a18;}
select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23888780' d='M5 7L0 2h10z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;cursor:pointer;}
select:focus,input[type=text]:focus,input[type=email]:focus,input[type=month]:focus{outline:none;border-color:rgba(0,0,0,0.3);}
.xn-input{font-weight:500;}
.xn-input::placeholder{font-weight:400;color:#b4b2a9;}
textarea{width:100%;min-height:200px;resize:vertical;padding:12px 14px;border:0.5px solid rgba(0,0,0,0.15);border-radius:8px;font-size:12px;font-family:Menlo,Consolas,monospace;background:#fff;color:#1a1a18;line-height:1.5;}
textarea:focus{outline:none;border-color:rgba(0,0,0,0.3);}
textarea::placeholder{color:#b4b2a9;}

/* Badges */
.rbadge{display:inline-flex;align-items:center;gap:5px;font-size:11px;font-weight:500;padding:3px 9px;border-radius:99px;margin-top:6px;}
.rbadge.ok{background:#eaf3de;color:#1a1a18;}
.rbadge.exp{background:#fcebeb;color:#1a1a18;}

/* Member preview */
.mpreview{background:#fff;border:0.5px solid rgba(0,0,0,0.1);border-radius:8px;padding:10px 14px;margin-top:8px;}
.mpreview-title{font-size:11px;color:#888780;font-weight:500;margin-bottom:6px;text-transform:uppercase;letter-spacing:.03em;}
.chips{display:flex;flex-wrap:wrap;gap:5px;}
.chip{font-size:12px;padding:3px 9px;background:#f1efe8;border-radius:99px;color:#444441;}

/* PDF upload */
.pdf-drop{border:0.5px dashed rgba(0,0,0,0.2);border-radius:8px;padding:8px 14px;text-align:center;cursor:pointer;color:#888780;font-size:13px;background:#fff;display:inline-block;}
.pdf-drop:hover{background:#f1efe8;}
.pdf-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;}
.pdf-tag{font-size:12px;padding:3px 10px;background:#e6f1fb;color:#185fa5;border-radius:99px;display:flex;align-items:center;gap:5px;border:0.5px solid rgba(24,95,165,0.2);}
.pdf-tag button{background:none;border:none;cursor:pointer;color:#185fa5;font-size:15px;line-height:1;padding:0;opacity:.6;}
.pdf-tag button:hover{opacity:1;}

/* Stored estimates */
.stored-estimates{background:#fff;border:0.5px solid rgba(24,95,165,0.2);border-radius:8px;padding:12px 14px;}
.stored-estimates-title{font-size:12px;font-weight:500;color:#185fa5;margin-bottom:8px;display:flex;align-items:center;justify-content:space-between;}
.est-item{font-size:12px;color:#1a1a18;padding:6px 0;border-bottom:0.5px solid rgba(0,0,0,0.06);}
.est-item:last-child{border-bottom:none;}
.est-item-name{font-weight:500;}
.est-item-detail{color:#5f5e5a;margin-top:2px;}
.clear-estimates-btn{font-size:11px;color:#a32d2d;border:none;background:none;cursor:pointer;padding:0;}
.clear-estimates-btn:hover{text-decoration:underline;}

/* Buttons */
.btn-primary{padding:10px 22px;background:#1a1a18;color:#fff;border:none;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;align-self:flex-start;}
.btn-primary:hover{opacity:.83;}
.btn-primary:disabled{opacity:.3;cursor:default;}
.btn-outline{padding:7px 14px;border:0.5px solid rgba(0,0,0,0.22);border-radius:7px;background:#fff;color:#1a1a18;font-size:13px;cursor:pointer;}
.btn-outline:hover{background:#f1efe8;}
.btn-sm{padding:5px 12px;font-size:12px;border:0.5px solid rgba(0,0,0,0.18);border-radius:6px;background:#fff;cursor:pointer;color:#444441;}
.btn-sm:hover{background:#f1efe8;}
.btn-sm.del{color:#a32d2d;border-color:rgba(163,45,45,0.3);}
.btn-sm.del:hover{background:#fcebeb;}

/* Chat */
#chat-phase{display:none;flex-direction:column;flex:1;}
#chat-phase.on{display:flex;}
.chat-header{padding:10px 20px;border-bottom:0.5px solid rgba(0,0,0,0.08);background:#fff;display:flex;align-items:center;gap:10px;}
.chat-wo-label{font-size:12px;font-weight:500;color:#1a1a18;}
.chat-assoc-label{font-size:12px;color:#888780;}
.chat-area{flex:1;padding:20px;display:flex;flex-direction:column;gap:14px;overflow-y:auto;max-height:calc(100vh - 52px - 44px - 58px);}
.mrow{display:flex;flex-direction:column;gap:5px;}
.mrow.u{align-items:flex-end;}
.mrow.a{align-items:flex-start;width:100%;}
.bubble{padding:11px 15px;border-radius:12px;font-size:13px;line-height:1.7;white-space:pre-wrap;word-break:break-word;}
.mrow.u .bubble{background:#fff;border:0.5px solid rgba(0,0,0,0.1);max-width:72%;color:#5f5e5a;font-style:italic;}
.mrow.a .bubble{background:#fff;border:0.5px solid rgba(0,0,0,0.1);width:100%;color:#1a1a18;}
.bactions{display:flex;gap:6px;flex-wrap:wrap;}
.cbtn{font-size:11px;font-weight:500;padding:4px 10px;border:0.5px solid rgba(0,0,0,0.18);border-radius:6px;background:#fff;cursor:pointer;color:#5f5e5a;}
.cbtn:hover{background:#f1efe8;}
.cbtn.done{color:#0f6e56;border-color:rgba(15,110,86,0.3);background:#e1f5ee;}
.trow{display:flex;align-items:center;gap:8px;padding:4px;}
.dots{display:flex;gap:4px;}
.dots span{width:6px;height:6px;border-radius:50%;background:#b4b2a9;animation:pulse 1.2s ease-in-out infinite;}
.dots span:nth-child(2){animation-delay:.2s;}
.dots span:nth-child(3){animation-delay:.4s;}
@keyframes pulse{0%,80%,100%{opacity:.3;transform:scale(.8);}40%{opacity:1;transform:scale(1);}}
.tlabel{font-size:12px;color:#888780;}
.chat-bar{display:none;gap:10px;padding:12px 20px;border-top:0.5px solid rgba(0,0,0,0.1);background:#fff;}
.chat-bar.on{display:flex;}
.chat-bar input{flex:1;padding:9px 14px;border:0.5px solid rgba(0,0,0,0.18);border-radius:8px;font-size:14px;background:#fafaf8;color:#1a1a18;}
.chat-bar input:focus{outline:none;border-color:rgba(0,0,0,0.32);background:#fff;}
.chat-bar input:disabled{opacity:.5;}
.sbtn{padding:9px 18px;background:#1a1a18;color:#fff;border:none;border-radius:8px;font-size:13px;font-weight:500;cursor:pointer;}
.sbtn:disabled{opacity:.35;cursor:default;}
.sbtn:hover:not(:disabled){opacity:.82;}
.nwo-bar{display:none;padding:10px 20px;border-top:0.5px solid rgba(0,0,0,0.1);background:#fafaf8;justify-content:flex-end;}
.nwo-bar.on{display:flex;}
.nwo-btn{font-size:12px;padding:6px 14px;border:0.5px solid rgba(0,0,0,0.2);border-radius:6px;background:#fff;color:#5f5e5a;cursor:pointer;}
.nwo-btn:hover{background:#f1efe8;}

/* Associations & Vendors panels */
.apanel{padding:24px 20px;display:flex;flex-direction:column;gap:16px;}
.apanel-hd{display:flex;align-items:center;justify-content:space-between;}
.apanel-hd h2{font-size:15px;font-weight:500;}
.alist{display:flex;flex-direction:column;gap:10px;}
.acard{background:#fff;border:0.5px solid rgba(0,0,0,0.1);border-radius:10px;padding:14px 16px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;}
.acard.expd{border-color:rgba(163,45,45,0.25);background:#fff9f9;}
.acard-name{font-size:14px;font-weight:500;margin-bottom:4px;display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.acard-sub{font-size:12px;color:#5f5e5a;line-height:1.5;}
.acard-actions{display:flex;gap:6px;flex-shrink:0;align-items:flex-start;}
.exp-alert{background:#fcebeb;border:0.5px solid rgba(163,45,45,0.25);border-radius:8px;padding:12px 14px;font-size:13px;color:#791f1f;display:flex;align-items:flex-start;gap:10px;}

/* Trade badge */
.trade-badge{font-size:11px;padding:2px 8px;border-radius:99px;background:#f1efe8;color:#444441;border:0.5px solid rgba(0,0,0,0.1);white-space:nowrap;}

/* Vendor search */
.vendor-search{padding:9px 12px;border:0.5px solid rgba(0,0,0,0.18);border-radius:8px;font-size:13px;background:#fff;color:#1a1a18;width:100%;}
.vendor-search:focus{outline:none;border-color:rgba(0,0,0,0.3);}
.copy-email-btn{font-size:11px;padding:3px 8px;border:0.5px solid rgba(0,0,0,0.15);border-radius:5px;background:#fff;cursor:pointer;color:#5f5e5a;white-space:nowrap;}
.copy-email-btn:hover{background:#f1efe8;}
.copy-email-btn.copied{color:#0f6e56;border-color:rgba(15,110,86,0.3);}

/* Modal */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,0.35);z-index:200;display:none;align-items:center;justify-content:center;padding:20px;}
.overlay.on{display:flex;}
.modal{background:#fff;border-radius:12px;padding:24px;width:100%;max-width:520px;max-height:88vh;overflow-y:auto;display:flex;flex-direction:column;gap:16px;}
.modal-title{font-size:15px;font-weight:500;}
.frow{display:flex;flex-direction:column;gap:6px;}
.flabel2{font-size:12px;font-weight:500;color:#5f5e5a;text-transform:uppercase;letter-spacing:.03em;}
.mrow2{display:flex;gap:8px;margin-bottom:8px;}
.mrow2 input{flex:1;}
.rmbtn{padding:8px 12px;border:0.5px solid rgba(163,45,45,0.3);border-radius:6px;background:#fff;color:#a32d2d;cursor:pointer;font-size:13px;}
.rmbtn:hover{background:#fcebeb;}
.addlink{font-size:13px;color:#185fa5;cursor:pointer;border:none;background:none;padding:0;}
.addlink:hover{text-decoration:underline;}
.mfooter{display:flex;justify-content:flex-end;gap:8px;padding-top:4px;border-top:0.5px solid rgba(0,0,0,0.08);}
.bcancel{padding:8px 16px;border:0.5px solid rgba(0,0,0,0.18);border-radius:7px;background:#fff;color:#5f5e5a;cursor:pointer;font-size:13px;}
.bcancel:hover{background:#f1efe8;}
.bsave{padding:8px 18px;background:#1a1a18;color:#fff;border:none;border-radius:7px;font-size:13px;font-weight:500;cursor:pointer;}
.bsave:hover{opacity:.82;}

.trade-select{width:100%;padding:9px 12px;border:0.5px solid rgba(0,0,0,0.18);border-radius:8px;font-size:14px;background:#fff;color:#1a1a18;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23888780' d='M5 7L0 2h10z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;}
.trade-select:focus{outline:none;border-color:rgba(0,0,0,0.3);}
/* ── Login ── */
#login-screen{position:fixed;inset:0;background:#f5f5f3;display:flex;align-items:center;justify-content:center;z-index:999;}
#login-screen.hidden{display:none;}
.login-box{background:#fff;border-radius:12px;border:0.5px solid rgba(0,0,0,0.12);padding:32px;width:320px;box-shadow:0 2px 12px rgba(0,0,0,0.08);}
.login-title{font-size:18px;font-weight:600;color:#1a1a18;margin-bottom:6px;}
.login-sub{font-size:13px;color:#888780;margin-bottom:24px;}
.login-select{width:100%;padding:10px 12px;border:0.5px solid rgba(0,0,0,0.18);border-radius:8px;font-size:14px;background:#fff;margin-bottom:16px;}
.login-btn{width:100%;padding:10px;background:#1a1a18;color:#fff;border:none;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;}
.login-btn:hover{opacity:.85;}
.login-no-staff{font-size:13px;color:#a32d2d;text-align:center;padding:8px 0;}
.current-user{font-size:12px;color:#888780;display:flex;align-items:center;gap:6px;}
.switch-user{font-size:11px;color:#888780;text-decoration:underline;cursor:pointer;background:none;border:none;padding:0;}
.switch-user:hover{color:#1a1a18;}

/* ── Inline-label form rows (v1.2.3) ── */
.aform-row{display:flex;align-items:center;gap:12px;}
.flabel-inline{font-size:11px;font-weight:500;color:#5f5e5a;letter-spacing:.04em;text-transform:uppercase;width:96px;flex-shrink:0;}
.aform-row input[type=text]{width:auto;flex:0 0 auto;min-width:140px;}
.aform-row select{width:auto;flex:0 0 auto;min-width:220px;padding-right:36px;}
#xninput{width:220px;}
.aform-lock-row{display:flex;align-items:center;gap:10px;padding-left:108px;margin-top:-8px;}

/* v1.2.5: retire the Associations-tab warn-dot. checkWarn() still runs and toggles .on silently; the rbadge inside the tab is now the only expired-term signal. */
.warn-dot.on{display:none;}
