/* Portal layout & components (loads after styles.css) */
body{background:#F4F3EE}
.p-shell{display:flex;min-height:100vh}
.p-side{width:250px;background:#0D0D0D;color:#CFCFC9;flex:none;display:flex;flex-direction:column;position:sticky;top:0;height:100vh}
.p-side .p-logo{background:#fff;margin:18px;border-radius:12px;padding:10px 12px}
.p-side .p-logo img{height:44px;width:auto}
.p-side nav{flex:1;overflow:auto;padding:6px 12px}
.p-side nav button{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:none;border:none;color:#CFCFC9;font-family:var(--font-body);font-size:.95rem;font-weight:500;padding:12px 14px;border-radius:10px;cursor:pointer;margin-bottom:2px}
.p-side nav button:hover{background:#1D1D1D;color:#fff}
.p-side nav button.on{background:var(--green);color:#fff;font-weight:600}
.p-side nav button .badge{margin-left:auto}
.p-side .p-bottom{padding:14px 18px;border-top:1px solid #222;font-size:.8rem}
.p-side .p-bottom a{color:#F4C730}
.p-main{flex:1;min-width:0;display:flex;flex-direction:column}
.p-top{background:#fff;border-bottom:1px solid var(--line);padding:14px 26px;display:flex;justify-content:space-between;align-items:center;gap:14px;position:sticky;top:0;z-index:40}
.p-top h1{font-size:1.3rem}
.p-top .p-user{display:flex;align-items:center;gap:12px;font-size:.88rem;color:var(--muted)}
.p-top .avatar{width:38px;height:38px;border-radius:50%;background:var(--green);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700}
.p-content{padding:26px;max-width:1100px;width:100%}
.p-view{display:none}
.p-view.active{display:block}
.badge{display:inline-flex;align-items:center;gap:5px;font-size:.72rem;font-weight:700;padding:3px 10px;border-radius:99px;letter-spacing:.03em}
.badge.green{background:#E1F5E9;color:#00713A}
.badge.gold{background:#FBF0CE;color:#8A6503}
.badge.red{background:#FDE3E1;color:#B00E06}
.badge.gray{background:#ECEAE4;color:#5F5D58}
.badge.dot::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:14px;margin-bottom:22px}
.tile{background:#fff;border:1px solid var(--line);border-radius:14px;padding:18px}
.tile .t-num{font-family:var(--font-head);font-size:2rem;font-weight:700;color:#111;line-height:1.1}
.tile .t-label{font-size:.8rem;color:var(--muted);font-weight:600;margin-top:2px}
.tile.alert .t-num{color:var(--red-dark)}
.panel{background:#fff;border:1px solid var(--line);border-radius:16px;padding:22px;margin-bottom:18px}
.panel h2{font-size:1.15rem;margin-bottom:14px;font-family:var(--font-body);font-weight:700;color:#111}
.panel h2 small{font-weight:400;color:var(--muted);font-size:.82rem}
table.p-table{width:100%;border-collapse:collapse;font-size:.9rem}
table.p-table th{text-align:left;font-size:.75rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);padding:8px 10px;border-bottom:2px solid var(--line)}
table.p-table td{padding:11px 10px;border-bottom:1px solid #F0EEE8;vertical-align:top}
table.p-table tr:hover td{background:#FAF9F4}
.p-table .actions{white-space:nowrap}
.btn-sm{padding:7px 14px;font-size:.82rem;border-radius:99px}
.list-item{display:flex;gap:12px;align-items:flex-start;padding:13px 0;border-bottom:1px solid #F0EEE8}
.list-item:last-child{border-bottom:none}
.list-item .li-icon{width:38px;height:38px;border-radius:10px;background:var(--sage);display:flex;align-items:center;justify-content:center;flex:none;font-size:1.1rem}
.list-item b{display:block;font-size:.92rem;color:#111}
.list-item span{font-size:.82rem;color:var(--muted)}
.list-item .li-right{margin-left:auto;text-align:right;flex:none}
.msg-thread{max-height:380px;overflow-y:auto;display:flex;flex-direction:column;gap:10px;padding:6px 2px;margin-bottom:14px}
.msg{max-width:80%;padding:10px 14px;border-radius:14px;font-size:.9rem}
.msg.me{background:var(--green);color:#fff;align-self:flex-end;border-bottom-right-radius:4px}
.msg.them{background:#F1EFE9;align-self:flex-start;border-bottom-left-radius:4px}
.msg small{display:block;opacity:.7;font-size:.7rem;margin-top:4px}
.msg-compose{display:flex;gap:8px}
.msg-compose input{flex:1}
.demo-banner{background:#FFF6E8;border:1.5px solid var(--gold);color:#6B4E12;border-radius:12px;padding:12px 16px;font-size:.85rem;margin-bottom:18px}
.demo-banner b{color:#4A3608}
.bar-chart{display:flex;align-items:flex-end;gap:6px;height:150px;padding-top:10px}
.bar-chart .bar{flex:1;background:var(--green);border-radius:4px 4px 0 0;min-height:3px;position:relative;cursor:default}
.bar-chart .bar:hover{background:var(--green-dark)}
.bar-chart .bar .bv{position:absolute;top:-20px;left:50%;transform:translateX(-50%);font-size:.7rem;color:var(--muted);font-weight:600}
.bar-labels{display:flex;gap:6px;margin-top:6px}
.bar-labels span{flex:1;text-align:center;font-size:.65rem;color:var(--muted)}
.hbar-row{display:flex;align-items:center;gap:10px;margin-bottom:9px;font-size:.85rem}
.hbar-row .hb-label{width:120px;flex:none;color:#111;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hbar-row .hb-track{flex:1;background:#F0EEE8;border-radius:6px;height:18px;overflow:hidden}
.hbar-row .hb-fill{height:100%;background:var(--green);border-radius:6px}
.hbar-row .hb-val{width:34px;text-align:right;color:var(--muted);font-weight:600}
.form-def{max-width:640px}
.sig-box{background:var(--cream);border:1.5px dashed var(--gold-dark);border-radius:12px;padding:16px;margin-top:14px}
.pill-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.pill-tabs button{background:#fff;border:1.5px solid var(--line);border-radius:99px;padding:8px 16px;font-weight:600;font-size:.85rem;cursor:pointer;font-family:var(--font-body);color:var(--muted)}
.pill-tabs button.on{background:var(--green);border-color:var(--green);color:#fff}
.p-mobile-nav{display:none}
@media(max-width:900px){
  .p-side{position:fixed;left:-260px;transition:left .25s;z-index:100}
  .p-side.open{left:0}
  .p-mobile-nav{display:flex;background:none;border:none;cursor:pointer;padding:6px}
  .p-mobile-nav svg{width:26px;height:26px;stroke:#111}
  .p-content{padding:16px}
}
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:26px;background:linear-gradient(150deg,#0A0A0A,#262626)}
.login-card{background:#fff;border-radius:22px;padding:38px;max-width:460px;width:100%;box-shadow:0 30px 80px rgba(0,0,0,.4)}
.login-card .l-logo{text-align:center;margin-bottom:8px}
.login-card .l-logo img{height:64px;margin:0 auto}
.role-tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:20px 0}
.role-tabs button{padding:12px 8px;border:2px solid var(--line);border-radius:12px;background:#fff;font-family:var(--font-body);font-weight:700;font-size:.85rem;cursor:pointer;color:var(--muted)}
.role-tabs button.on{border-color:var(--green);background:var(--sage);color:var(--green-dark)}
.notif-dot{position:relative}
.notif-dot::after{content:attr(data-n);position:absolute;top:-6px;right:-8px;background:var(--red);color:#fff;font-size:.62rem;font-weight:700;min-width:16px;height:16px;border-radius:99px;display:flex;align-items:center;justify-content:center;padding:0 4px}
.notif-dot[data-n="0"]::after{display:none}
