/* =========================================================
   Coastal Living ROLEPLAY — department pages + member portals
   /departments/            index of departments
   /departments/<key>/      one department's public page
   /departments/portal/     members-only portal
   ========================================================= */

/* ---------- shared bits ---------- */
.dept-icon{width:24px; height:24px; flex:none;}
.md{font-size:14.5px; line-height:1.65; color:var(--ink-secondary); overflow-wrap:anywhere;}
.md > :first-child{margin-top:0;}
.md > :last-child{margin-bottom:0;}
.md h2, .md h3, .md h4{color:var(--ink); margin:1.3em 0 .5em; letter-spacing:.03em;}
.md h2{font-size:20px;} .md h3{font-size:16.5px;} .md h4{font-size:14px;}
.md p{margin:0 0 .9em;}
.md ul, .md ol{margin:0 0 .9em; padding-left:1.4em;}
.md li{margin:.2em 0;}
.md li.md-check{list-style:none; margin-left:-1.4em; display:flex; gap:8px; align-items:flex-start;}
.md .md-box{width:16px; height:16px; flex:none; margin-top:3px; border:1.5px solid var(--hairline-strong); border-radius:4px; display:grid; place-items:center; font-size:11px; font-weight:700; color:#fff;}
.md li.done .md-box{background:var(--good); border-color:var(--good);}
.md li.done > span:last-child{color:var(--ink-muted); text-decoration:line-through;}
.md blockquote{margin:0 0 .9em; padding:8px 14px; border-left:3px solid var(--dept-color, var(--op-fund)); background:var(--surface-2); border-radius:0 8px 8px 0;}
.md hr{border:none; border-top:1px solid var(--hairline-strong); margin:1.4em 0;}
.md code{font-family:ui-monospace, Consolas, monospace; font-size:.9em; background:var(--surface-2); padding:1px 5px; border-radius:4px;}
.md a{color:var(--op-fund-ink); text-decoration:underline; text-underline-offset:2px;}
.md strong{color:var(--ink);}
.md .md-table{overflow-x:auto; margin:0 0 1em; border:1px solid var(--hairline); border-radius:8px;}
.md table{min-width:0; font-size:13.5px;}
.md th{background:var(--surface-2); text-align:left; padding:8px 12px; font-size:12px; color:var(--ink); border-bottom:1px solid var(--hairline);}
.md td{padding:8px 12px; border-bottom:1px solid var(--hairline);}
.md tr:last-child td{border-bottom:none;}

.pill{display:inline-flex; align-items:center; gap:6px; font-family:"Oswald",sans-serif; font-size:11px; font-weight:600; letter-spacing:.07em; text-transform:uppercase; padding:3px 10px; border-radius:99px; white-space:nowrap;}
.pill i{width:7px; height:7px; border-radius:50%; background:currentColor; flex:none;}
.pill.hiring{color:var(--good); background:color-mix(in srgb, var(--good) 13%, transparent);}
.pill.closed{color:var(--critical); background:color-mix(in srgb, var(--critical) 12%, transparent);}
.pill.neutral{color:var(--ink-muted); background:var(--surface-2);}

/* ---------- index ---------- */
.dx-hero{padding:48px 0 10px;}
.dx-hero h1{font-size:clamp(30px,4.4vw,46px); font-weight:600;}
.dx-hero p{color:var(--ink-secondary); max-width:68ch; margin-top:12px; font-size:16px;}
.dx-group{margin-top:44px;}
.dx-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(290px, 1fr)); gap:20px;}
.dx-card{
  position:relative; display:flex; flex-direction:column; background:var(--surface); border:1px solid var(--hairline);
  border-radius:16px; overflow:hidden; box-shadow:var(--shadow); color:inherit; transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dx-card:hover{transform:translateY(-3px); border-color:color-mix(in srgb, var(--dept-color) 50%, var(--hairline)); box-shadow:0 18px 40px -20px color-mix(in srgb, var(--dept-color) 60%, transparent);}
.dx-cover{position:relative; height:150px; background:linear-gradient(135deg, var(--dept-color), color-mix(in srgb, var(--dept-color) 45%, #0b1218)); overflow:hidden;}
.dx-cover img{width:100%; height:100%; object-fit:cover;}
.dx-cover::after{content:""; position:absolute; inset:0; background:linear-gradient(180deg, transparent 35%, rgba(5,10,15,.65));}
.dx-cover .dx-watermark{position:absolute; right:-18px; bottom:-26px; width:150px; height:150px; color:rgba(255,255,255,.14);}
.dx-badge{
  position:absolute; left:18px; top:121px; z-index:2; width:58px; height:58px; border-radius:14px; display:grid; place-items:center;
  background:var(--surface); color:var(--dept-color); border:1px solid var(--hairline); box-shadow:var(--shadow);
}
.dx-badge svg{width:32px; height:32px;}
.dx-cover .pill{position:absolute; right:12px; top:12px; z-index:2; background:rgba(8,14,20,.6); backdrop-filter:blur(6px);}
.dx-cover .pill.hiring{color:#7ee87e;} .dx-cover .pill.closed{color:#ff9d9d;}
.dx-cover[style*="height:90px"] ~ .dx-badge{top:61px;}
.dx-body{padding:42px 20px 18px; display:flex; flex-direction:column; gap:6px; flex:1;}
.dx-body h3{font-size:18px; font-weight:600; line-height:1.25;}
.dx-body .acr{font-family:"Oswald",sans-serif; font-size:12px; font-weight:600; letter-spacing:.1em; color:var(--dept-color);}
.dx-body p{margin:0; font-size:13px; color:var(--ink-muted);}
.dx-foot{display:flex; align-items:center; gap:10px; padding:12px 20px; border-top:1px solid var(--hairline); font-size:12.5px; color:var(--ink-muted);}
.dx-foot .go{margin-left:auto; font-family:"Oswald",sans-serif; font-weight:600; letter-spacing:.06em; text-transform:uppercase; font-size:12px; color:var(--dept-color);}
.dx-card.is-closed .dx-cover{filter:grayscale(.6);}

/* ---------- department page ---------- */
.dp-hero{position:relative; min-height:340px; display:flex; align-items:flex-end; color:#fff; overflow:hidden;
  background:linear-gradient(135deg, var(--dept-color), color-mix(in srgb, var(--dept-color) 35%, #050a0f));}
.dp-hero > img{position:absolute; inset:0; width:100%; height:100%; object-fit:cover;}
.dp-hero::after{content:""; position:absolute; inset:0; background:linear-gradient(180deg, rgba(5,10,15,.15) 0%, rgba(5,10,15,.55) 55%, rgba(5,10,15,.88) 100%);}
.dp-hero .wrap{position:relative; z-index:2; width:100%; padding-top:60px; padding-bottom:34px;}
.dp-hero .dp-watermark{position:absolute; right:4%; top:50%; transform:translateY(-50%); width:300px; height:300px; color:rgba(255,255,255,.08); z-index:1;}
.dp-crumb{font-family:"Oswald",sans-serif; font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:rgba(255,255,255,.75);}
.dp-crumb a{color:rgba(255,255,255,.85);} .dp-crumb a:hover{color:#fff;}
.dp-title{display:flex; align-items:center; gap:18px; margin-top:16px;}
.dp-seal{width:76px; height:76px; border-radius:18px; flex:none; display:grid; place-items:center; background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.25); backdrop-filter:blur(8px);}
.dp-seal svg{width:44px; height:44px; color:#fff;}
.dp-title h1{color:#fff; font-size:clamp(26px,4vw,44px); font-weight:600; line-height:1.1;}
.dp-title .sub{color:rgba(255,255,255,.82); margin-top:6px; font-size:14.5px;}
.dp-motto{font-style:italic; color:rgba(255,255,255,.88); margin-top:14px; font-size:15px;}
.dp-actions{display:flex; flex-wrap:wrap; gap:10px; margin-top:22px; align-items:center;}
.dp-actions .btn-light{background:#fff; color:#0b1218;}
.dp-actions .btn-glass{background:rgba(255,255,255,.12); color:#fff; border-color:rgba(255,255,255,.35); backdrop-filter:blur(6px);}
.dp-actions .pill.hiring{background:rgba(36,198,36,.18); color:#9ff59f;}
.dp-actions .pill.closed{background:rgba(239,106,106,.2); color:#ffb3b3;}
.dp-subnav{position:sticky; top:68px; z-index:30; background:color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter:blur(10px); border-bottom:1px solid var(--hairline);}
.dp-subnav .wrap{display:flex; gap:4px; overflow-x:auto; scrollbar-width:none;}
.dp-subnav a{flex:none; font-family:"Oswald",sans-serif; font-size:12.5px; font-weight:600; letter-spacing:.07em; text-transform:uppercase; color:var(--ink-muted); padding:13px 12px; border-bottom:2px solid transparent;}
.dp-subnav a:hover{color:var(--ink);}
.dp-subnav a.on{color:var(--dept-color); border-bottom-color:var(--dept-color);}
.dp-section{scroll-margin-top:130px; margin-top:44px;}
.dp-section > h2{font-size:22px; font-weight:600; display:flex; align-items:center; gap:12px; margin-bottom:18px;}
.dp-section > h2::before{content:""; width:5px; height:22px; border-radius:3px; background:var(--dept-color);}
.dp-two{display:grid; grid-template-columns:minmax(0,1.6fr) minmax(0,1fr); gap:22px; align-items:start;}
@media (max-width:900px){ .dp-two{grid-template-columns:1fr;} }
.dp-facts{display:flex; flex-direction:column; gap:0;}
.dp-facts div{display:flex; justify-content:space-between; gap:12px; padding:11px 0; border-bottom:1px solid var(--hairline); font-size:13.5px;}
.dp-facts div:last-child{border-bottom:none;}
.dp-facts span{color:var(--ink-muted);} .dp-facts b{color:var(--ink); text-align:right;}
.dp-divs{display:grid; grid-template-columns:repeat(auto-fill, minmax(240px,1fr)); gap:14px;}
.dp-div{padding:18px; border-radius:12px; background:var(--surface); border:1px solid var(--hairline); border-top:3px solid var(--dept-color); box-shadow:var(--shadow);}
.dp-div h3{font-size:15px; font-weight:600; margin-bottom:6px;}
.dp-div p{margin:0; font-size:13px; color:var(--ink-secondary);}
.dp-ranks{list-style:none; margin:0; padding:0; counter-reset:rk;}
.dp-ranks li{counter-increment:rk; display:grid; grid-template-columns:30px 1fr; gap:10px; padding:9px 0; border-bottom:1px solid var(--hairline); font-size:13.5px; color:var(--ink-secondary);}
.dp-ranks li:last-child{border-bottom:none;}
.dp-ranks li::before{content:counter(rk); width:24px; height:24px; border-radius:50%; display:grid; place-items:center; font-family:"Oswald",sans-serif; font-size:11px; font-weight:600; color:var(--dept-color); background:var(--dept-tint);}
.dp-ranks b{color:var(--ink); display:block;}
.dp-cs{width:100%; min-width:0; font-size:13.5px;}
.dp-cs td{padding:8px 0; border-bottom:1px solid var(--hairline);}
.dp-cs tr:last-child td{border-bottom:none;}
.dp-cs td.tag{font-family:"Oswald",sans-serif; font-weight:600; color:var(--dept-color); white-space:nowrap; padding-right:16px; width:1%;}
.dp-fleet{display:grid; grid-template-columns:repeat(auto-fill, minmax(220px,1fr)); gap:10px;}
.dp-fleet div{display:flex; justify-content:space-between; gap:10px; padding:11px 14px; border-radius:10px; background:var(--surface-2); font-size:13.5px; color:var(--ink);}
.dp-fleet span{font-family:"Oswald",sans-serif; font-weight:600; color:var(--ink-secondary); white-space:nowrap;}
.dp-command{display:grid; grid-template-columns:repeat(auto-fill, minmax(200px,1fr)); gap:12px; margin-bottom:18px;}
.dp-person{display:flex; gap:12px; align-items:center; padding:14px; border-radius:12px; background:var(--surface); border:1px solid var(--hairline); box-shadow:var(--shadow);}
.dp-person b{display:block; color:var(--ink); font-size:14px;}
.dp-person small{color:var(--ink-muted); font-size:12px;}
.avatar{width:40px; height:40px; border-radius:50%; flex:none; display:grid; place-items:center; font-family:"Oswald",sans-serif; font-weight:600; font-size:15px; color:#fff; background:var(--dept-color, var(--op-fund)); object-fit:cover;}
.avatar.sm{width:30px; height:30px; font-size:12px;}
.avatar.lg{width:72px; height:72px; font-size:26px; border-radius:18px;}
.dp-gallery{display:grid; grid-template-columns:repeat(auto-fill, minmax(240px,1fr)); gap:12px;}
.dp-gallery figure{margin:0; position:relative; border-radius:12px; overflow:hidden; background:var(--surface-2); aspect-ratio:16/10; cursor:zoom-in;}
.dp-gallery img{width:100%; height:100%; object-fit:cover; transition:transform .3s ease;}
.dp-gallery figure:hover img{transform:scale(1.04);}
.dp-gallery figcaption{position:absolute; left:0; right:0; bottom:0; padding:18px 12px 9px; font-size:12.5px; color:#fff; background:linear-gradient(transparent, rgba(0,0,0,.7));}
.lightbox{position:fixed; inset:0; z-index:90; background:rgba(4,8,12,.92); display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px; cursor:zoom-out;}
.lightbox img{max-width:100%; max-height:calc(100vh - 90px); border-radius:8px;}
.lightbox p{color:#fff; margin-top:12px; font-size:14px;}
.dp-join{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:22px;}
@media (max-width:820px){ .dp-join{grid-template-columns:1fr;} }
.dp-req{list-style:none; margin:0; padding:0;}
.dp-req li{display:flex; gap:10px; padding:8px 0; font-size:14px; color:var(--ink-secondary);}
.dp-req li::before{content:"✓"; flex:none; width:20px; height:20px; border-radius:50%; display:grid; place-items:center; font-size:11px; font-weight:700; color:#fff; background:var(--dept-color);}
.dp-cta{display:flex; flex-direction:column; gap:14px; justify-content:center; padding:26px; border-radius:16px; color:#fff;
  background:linear-gradient(135deg, var(--dept-color), color-mix(in srgb, var(--dept-color) 40%, #050a0f));}
.dp-cta h3{color:#fff; font-size:22px;}
.dp-cta p{margin:0; color:rgba(255,255,255,.85); font-size:14px; white-space:pre-line;}
.dp-cta .btn{align-self:flex-start; background:#fff; color:#0b1218;}
.dp-empty{color:var(--ink-muted); font-size:13.5px; font-style:italic;}
.dp-roster-filter{display:flex; gap:10px; margin-bottom:12px; flex-wrap:wrap;}
.dp-roster-filter input{font:inherit; font-size:13.5px; padding:8px 12px; border-radius:8px; border:1px solid var(--hairline-strong); background:var(--surface); color:var(--ink); min-width:220px;}

/* ---------- portal shell ---------- */
body.portal{background:var(--page-bg);}
.pt{display:grid; grid-template-columns:260px minmax(0,1fr); min-height:calc(100vh - 69px);}
.pt-side{position:sticky; top:69px; height:calc(100vh - 69px); overflow-y:auto; background:var(--surface); border-right:1px solid var(--hairline); display:flex; flex-direction:column;}
.pt-brand{display:flex; gap:12px; align-items:center; padding:20px 18px 16px; border-bottom:1px solid var(--hairline);
  background:linear-gradient(135deg, color-mix(in srgb, var(--dept-color) 16%, transparent), transparent);}
.pt-brand .seal{width:44px; height:44px; border-radius:12px; flex:none; display:grid; place-items:center; background:var(--dept-color); color:#fff;}
.pt-brand .seal svg{width:26px; height:26px;}
.pt-brand b{display:block; font-family:"Oswald",sans-serif; font-size:16px; letter-spacing:.06em; color:var(--ink);}
.pt-brand small{display:block; font-size:11.5px; color:var(--ink-muted); line-height:1.3;}
.pt-switch{margin:10px 14px 0; font:inherit; font-size:12.5px; padding:6px 8px; border-radius:8px; border:1px solid var(--hairline-strong); background:var(--surface-2); color:var(--ink-secondary);}
.pt-nav{display:flex; flex-direction:column; gap:2px; padding:12px 10px;}
.pt-nav .grp{font-family:"Oswald",sans-serif; font-size:10.5px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-muted); padding:14px 10px 6px;}
.pt-nav a{display:flex; align-items:center; gap:11px; padding:9px 10px; border-radius:9px; font-size:14px; font-weight:500; color:var(--ink-secondary);}
.pt-nav a svg{width:18px; height:18px; flex:none; opacity:.8;}
.pt-nav a:hover{background:var(--surface-2); color:var(--ink);}
.pt-nav a.on{background:color-mix(in srgb, var(--dept-color) 14%, transparent); color:var(--dept-color); font-weight:600;}
.pt-nav a.on svg{opacity:1;}
.pt-nav .cnt{margin-left:auto; min-width:20px; height:20px; padding:0 6px; border-radius:99px; background:var(--critical); color:#fff; font-size:11px; font-weight:700; display:grid; place-items:center;}
.pt-nav .cnt[hidden]{display:none;}
.pt-me{margin-top:auto; display:flex; gap:10px; align-items:center; padding:14px 16px; border-top:1px solid var(--hairline); font-size:12.5px;}
.pt-me b{display:block; color:var(--ink); font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.pt-me small{color:var(--ink-muted);}
.pt-me > div{min-width:0;}
.pt-main{min-width:0; padding:28px clamp(16px, 3vw, 40px) 60px;}
.pt-head{display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; margin-bottom:22px;}
.pt-head h1{font-size:clamp(22px,2.6vw,30px); font-weight:600;}
.pt-head .eyebrow{margin-bottom:4px; color:var(--dept-color);}
.pt-head .acts{margin-left:auto; display:flex; gap:8px; flex-wrap:wrap;}
.pt-menu-btn{display:none;}
@media (max-width:900px){
  .pt{grid-template-columns:1fr;}
  .pt-side{position:fixed; left:0; top:0; bottom:0; height:100vh; width:280px; z-index:75; transform:translateX(-100%); transition:transform .2s ease; box-shadow:var(--shadow);}
  .pt.side-open .pt-side{transform:none;}
  .pt.side-open::after{content:""; position:fixed; inset:0; z-index:74; background:rgba(4,8,12,.5);}
  .pt-menu-btn{display:inline-flex;}
}

/* ---------- portal widgets ---------- */
.tiles{display:grid; grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); gap:14px; margin-bottom:22px;}
.tile{padding:16px 18px; border-radius:14px; background:var(--surface); border:1px solid var(--hairline); box-shadow:var(--shadow); display:flex; flex-direction:column; gap:4px; color:inherit;}
a.tile:hover{border-color:var(--dept-color);}
.tile small{font-family:"Oswald",sans-serif; font-size:11px; font-weight:600; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-muted);}
.tile b{font-family:"Oswald",sans-serif; font-size:30px; font-weight:600; color:var(--ink); line-height:1.1;}
.tile span{font-size:12px; color:var(--ink-muted);}
.tile.accent{background:linear-gradient(135deg, var(--dept-color), color-mix(in srgb, var(--dept-color) 50%, #050a0f)); border-color:transparent;}
.tile.accent small, .tile.accent span{color:rgba(255,255,255,.78);} .tile.accent b{color:#fff;}
.dash{display:grid; grid-template-columns:minmax(0,1.5fr) minmax(0,1fr); gap:20px; align-items:start;}
@media (max-width:1100px){ .dash{grid-template-columns:1fr;} }
.panel{background:var(--surface); border:1px solid var(--hairline); border-radius:14px; box-shadow:var(--shadow); margin-bottom:20px; overflow:hidden;}
.panel > header{display:flex; align-items:center; gap:10px; padding:14px 18px; border-bottom:1px solid var(--hairline);}
.panel > header h3{font-size:13.5px; font-weight:600; letter-spacing:.07em;}
.panel > header a, .panel > header button.link{margin-left:auto; font-size:12.5px; color:var(--op-fund-ink); background:none; border:none; cursor:pointer; font-weight:600;}
.panel > .body{padding:16px 18px;}
.panel .empty{padding:22px 18px; text-align:center; color:var(--ink-muted); font-size:13.5px;}
.rows{display:flex; flex-direction:column;}
.row{display:flex; align-items:center; gap:12px; padding:12px 18px; border-bottom:1px solid var(--hairline); color:inherit; text-align:left; font:inherit; background:none; border-left:none; border-right:none; border-top:none; width:100%; cursor:pointer;}
.row:last-child{border-bottom:none;}
.row:hover{background:var(--surface-2);}
.row .main{flex:1; min-width:0; display:flex; flex-direction:column;}
.row .main b{color:var(--ink); font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.row .main small{color:var(--ink-muted); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.row .side{font-size:12px; color:var(--ink-muted); white-space:nowrap; text-align:right;}
.ico{width:36px; height:36px; border-radius:10px; flex:none; display:grid; place-items:center; background:var(--dept-tint); color:var(--dept-color);}
.ico svg{width:18px; height:18px;}
.ico.pdf{background:color-mix(in srgb, #d03b3b 14%, transparent); color:#d03b3b;}
.ico.word{background:color-mix(in srgb, #2b5ea8 14%, transparent); color:#2b5ea8;}
.ico.xls{background:color-mix(in srgb, #0b800b 14%, transparent); color:#0b800b;}
.ico.img{background:color-mix(in srgb, #9c6607 14%, transparent); color:#9c6607;}

.ann{padding:16px 18px; border-bottom:1px solid var(--hairline); border-left:4px solid transparent;}
.ann:last-child{border-bottom:none;}
.ann.important{border-left-color:var(--warning);}
.ann.urgent{border-left-color:var(--critical); background:color-mix(in srgb, var(--critical) 5%, transparent);}
.ann-head{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:6px;}
.ann-head h4{font-family:"Public Sans",sans-serif; text-transform:none; letter-spacing:0; font-size:15.5px; font-weight:700;}
.ann-meta{font-size:12px; color:var(--ink-muted); margin-top:8px; display:flex; gap:12px; align-items:center; flex-wrap:wrap;}
.ann-meta button{font:inherit; font-size:12px; background:none; border:none; color:var(--op-fund-ink); cursor:pointer; padding:0;}
.ann.clamp .md{display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden;}

.tag{display:inline-flex; align-items:center; font-size:11px; font-weight:600; padding:2px 8px; border-radius:6px; background:var(--surface-2); color:var(--ink-secondary); white-space:nowrap;}
.tag.dept{background:var(--dept-tint); color:var(--dept-color);}
.tag.good{background:color-mix(in srgb, var(--good) 13%, transparent); color:var(--good);}
.tag.warn{background:color-mix(in srgb, var(--warning) 15%, transparent); color:var(--warning);}
.tag.bad{background:color-mix(in srgb, var(--critical) 13%, transparent); color:var(--critical);}
.tags{display:flex; gap:5px; flex-wrap:wrap;}

.toolbar{display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:14px;}
.toolbar input[type=search], .toolbar select, .inp{font:inherit; font-size:13.5px; padding:8px 11px; border-radius:8px; border:1px solid var(--hairline-strong); background:var(--surface); color:var(--ink);}
.toolbar input[type=search]{min-width:240px; flex:1; max-width:360px;}
.seg{display:inline-flex; background:var(--surface-2); border:1px solid var(--hairline); border-radius:9px; padding:3px;}
.seg button{font:inherit; font-size:12.5px; font-weight:600; padding:6px 12px; border-radius:7px; border:none; background:none; color:var(--ink-secondary); cursor:pointer;}
.seg button.on{background:var(--surface); color:var(--ink); box-shadow:var(--shadow);}

table.grid{min-width:720px;}
table.grid tbody tr{cursor:pointer;}
table.grid tbody tr:hover td{background:var(--surface-2);}
table.grid td .who{display:flex; align-items:center; gap:10px;}
table.grid td .who b{color:var(--ink); font-weight:600; display:block;}
table.grid td .who small{color:var(--ink-muted); font-size:11.5px;}

/* personnel file */
.pf-head{display:flex; gap:18px; align-items:center; padding:22px; flex-wrap:wrap;
  background:linear-gradient(135deg, color-mix(in srgb, var(--dept-color) 14%, var(--surface)), var(--surface));}
.pf-head h2{font-size:24px; font-weight:600;}
.pf-head .meta{display:flex; gap:8px; flex-wrap:wrap; margin-top:8px;}
.pf-head .acts{margin-left:auto; display:flex; gap:8px; flex-wrap:wrap;}
.pf-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(170px,1fr)); gap:1px; background:var(--hairline); border-top:1px solid var(--hairline);}
.pf-grid div{background:var(--surface); padding:12px 18px;}
.pf-grid small{display:block; font-size:11px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-muted); font-weight:600;}
.pf-grid b{color:var(--ink); font-size:14px; font-weight:600;}
.timeline{list-style:none; margin:0; padding:6px 18px 6px 40px; position:relative;}
.timeline::before{content:""; position:absolute; left:25px; top:16px; bottom:16px; width:2px; background:var(--hairline);}
.timeline li{position:relative; padding:12px 0; border-bottom:1px solid var(--hairline);}
.timeline li:last-child{border-bottom:none;}
.timeline li::before{content:""; position:absolute; left:-20px; top:17px; width:12px; height:12px; border-radius:50%; background:var(--surface); border:3px solid var(--tl, var(--ink-muted));}
.timeline .k-promotion, .timeline .k-hire{--tl:var(--good);} .timeline .k-commendation{--tl:var(--accent);}
.timeline .k-discipline, .timeline .k-demotion{--tl:var(--critical);} .timeline .k-training{--tl:var(--op-fund);}
.timeline .k-status, .timeline .k-transfer{--tl:var(--warning);}
.timeline b{color:var(--ink); font-size:14px;}
.timeline p{margin:4px 0 0; font-size:13px; color:var(--ink-secondary); white-space:pre-wrap;}
.timeline small{display:block; font-size:11.5px; color:var(--ink-muted); margin-top:4px;}

/* documents */
.docs{display:grid; grid-template-columns:230px minmax(0,1fr); gap:20px; align-items:start;}
@media (max-width:820px){ .docs{grid-template-columns:1fr;} }
.folders{display:flex; flex-direction:column; gap:2px; padding:8px;}
.folders button{display:flex; align-items:center; gap:9px; text-align:left; font:inherit; font-size:13.5px; padding:8px 10px; border-radius:8px; border:none; background:none; color:var(--ink-secondary); cursor:pointer;}
.folders button svg{width:16px; height:16px; flex:none;}
.folders button:hover{background:var(--surface-2);}
.folders button.on{background:var(--dept-tint); color:var(--dept-color); font-weight:600;}
.folders button span{margin-left:auto; font-size:11.5px; color:var(--ink-muted);}
.doc-paper{max-width:900px; margin:0 auto; background:var(--surface); border:1px solid var(--hairline); border-radius:6px; box-shadow:var(--shadow); padding:clamp(22px,5vw,56px);}
.doc-letterhead{display:flex; align-items:center; gap:16px; padding-bottom:16px; border-bottom:3px double var(--dept-color); margin-bottom:22px;}
.doc-letterhead .seal{width:54px; height:54px; border-radius:50%; display:grid; place-items:center; background:var(--dept-color); color:#fff; flex:none;}
.doc-letterhead .seal svg{width:30px; height:30px;}
.doc-letterhead b{display:block; font-family:"Oswald",sans-serif; font-size:17px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink);}
.doc-letterhead small{color:var(--ink-muted); font-size:12px;}
.doc-letterhead .docno{margin-left:auto; text-align:right; font-size:11.5px; color:var(--ink-muted);}
.doc-paper h1.doc-title{font-size:26px; font-weight:600; margin-bottom:6px;}
.doc-sub{font-size:12.5px; color:var(--ink-muted); margin-bottom:22px;}
.doc-file{display:flex; gap:14px; align-items:center; padding:16px; border:1px solid var(--hairline); border-radius:12px; background:var(--surface-2);}
.doc-frame{width:100%; height:78vh; border:1px solid var(--hairline); border-radius:10px; margin-top:16px; background:#fff;}
.editor{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px;}
@media (max-width:1000px){ .editor{grid-template-columns:1fr;} }
.editor textarea{width:100%; min-height:62vh; font-family:ui-monospace, Consolas, monospace; font-size:13.5px; line-height:1.6; padding:14px; border-radius:10px; border:1px solid var(--hairline-strong); background:var(--surface); color:var(--ink); resize:vertical;}
.editor .preview{min-height:62vh; max-height:80vh; overflow:auto;}
.mdbar{display:flex; gap:4px; flex-wrap:wrap; margin-bottom:8px;}
.mdbar button{font:inherit; font-size:12.5px; font-weight:700; min-width:32px; height:30px; padding:0 8px; border-radius:7px; border:1px solid var(--hairline-strong); background:var(--surface); color:var(--ink-secondary); cursor:pointer;}
.mdbar button:hover{color:var(--ink); border-color:var(--ink-muted);}
.tpls{display:grid; grid-template-columns:repeat(auto-fill, minmax(170px,1fr)); gap:10px;}
.tpls button{display:flex; flex-direction:column; gap:4px; text-align:left; font:inherit; padding:14px; border-radius:12px; border:1px solid var(--hairline); background:var(--surface-2); color:var(--ink-secondary); cursor:pointer;}
.tpls button:hover{border-color:var(--dept-color);}
.tpls button b{color:var(--ink); font-size:14px;}
.tpls button small{font-size:12px;}

/* calendar */
.cal{display:grid; grid-template-columns:repeat(7, minmax(0,1fr)); border-top:1px solid var(--hairline); border-left:1px solid var(--hairline);}
.cal .dow{font-family:"Oswald",sans-serif; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-muted); padding:8px; text-align:center; border-right:1px solid var(--hairline); border-bottom:1px solid var(--hairline); background:var(--surface-2);}
.cal .day{min-height:96px; padding:6px; border-right:1px solid var(--hairline); border-bottom:1px solid var(--hairline); background:var(--surface); cursor:pointer; display:flex; flex-direction:column; gap:3px; text-align:left; font:inherit; border-top:none; border-left:none; min-width:0;}
.cal .day:hover{background:var(--surface-2);}
.cal .day.out{background:var(--page-bg); color:var(--ink-muted);}
.cal .day.sel{outline:2px solid var(--dept-color); outline-offset:-2px;}
.cal .day .n{font-size:12.5px; font-weight:600; color:var(--ink-secondary);}
.cal .day.today .n{background:var(--dept-color); color:#fff; border-radius:99px; width:24px; height:24px; display:grid; place-items:center;}
.cal .ev{font-size:11px; padding:2px 6px; border-radius:5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; background:var(--ev-tint); color:var(--ev);}
.cal .more{font-size:11px; color:var(--ink-muted);}
@media (max-width:700px){ .cal .day{min-height:58px;} .cal .ev{font-size:0; height:6px; padding:0;} }
.k-shift{--ev:#2b5ea8; --ev-tint:rgba(43,94,168,.13);}
.k-training{--ev:#0b800b; --ev-tint:rgba(11,128,11,.13);}
.k-meeting{--ev:#9c6607; --ev-tint:rgba(156,102,7,.15);}
.k-event{--ev:#6b4fa8; --ev-tint:rgba(107,79,168,.13);}
.k-detail{--ev:#b23a2e; --ev-tint:rgba(178,58,46,.13);}
.evcard{padding:14px 18px; border-bottom:1px solid var(--hairline); border-left:4px solid var(--ev);}
.evcard:last-child{border-bottom:none;}
.evcard h4{font-family:"Public Sans",sans-serif; text-transform:none; letter-spacing:0; font-size:15px; font-weight:700;}
.evcard .when{font-size:12.5px; color:var(--ink-secondary); margin-top:2px;}
.evcard .who{font-size:12px; color:var(--ink-muted); margin-top:6px;}
.evcard .acts{display:flex; gap:6px; margin-top:10px; flex-wrap:wrap;}
.evcard .acts .btn.on{background:var(--dept-color); color:#fff; border-color:var(--dept-color);}

/* modal + form bits */
.modal-bg{position:fixed; inset:0; z-index:80; background:rgba(6,11,16,.6); display:flex; align-items:flex-start; justify-content:center; padding:5vh 16px; overflow-y:auto;}
.modal{width:100%; max-width:640px; background:var(--surface); border:1px solid var(--hairline); border-radius:16px; box-shadow:0 30px 80px -30px rgba(0,0,0,.6); display:flex; flex-direction:column;}
.modal.wide{max-width:900px;}
.modal > header{display:flex; align-items:center; gap:10px; padding:18px 22px; border-bottom:1px solid var(--hairline);}
.modal > header h2{font-size:18px; font-weight:600;}
.modal > header .x{margin-left:auto; border:none; background:none; font-size:24px; line-height:1; color:var(--ink-muted); cursor:pointer;}
.modal > .body{padding:20px 22px; display:flex; flex-direction:column; gap:16px;}
.modal > footer{display:flex; gap:10px; justify-content:flex-end; align-items:center; padding:14px 22px; border-top:1px solid var(--hairline); flex-wrap:wrap;}
.modal > footer .err{margin-right:auto; color:var(--critical); font-size:13px;}
.f{display:flex; flex-direction:column; gap:6px; min-width:0;}
.f label{font-family:"Oswald",sans-serif; font-size:11.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-secondary);}
.f .hint{font-size:11.5px; color:var(--ink-muted);}
.f input, .f select, .f textarea{font:inherit; font-size:14px; padding:9px 11px; border-radius:8px; border:1px solid var(--hairline-strong); background:var(--surface); color:var(--ink); width:100%;}
.f textarea{min-height:100px; resize:vertical; line-height:1.5;}
.fr{display:grid; grid-template-columns:repeat(auto-fit, minmax(160px,1fr)); gap:14px;}
.chk{display:flex; gap:8px; align-items:center; font-size:13.5px; color:var(--ink-secondary);}
.chk input{width:16px; height:16px;}
.chips{display:flex; flex-wrap:wrap; gap:6px;}
.chips label{display:inline-flex; gap:6px; align-items:center; font-size:12.5px; padding:5px 10px; border-radius:99px; border:1px solid var(--hairline-strong); cursor:pointer; color:var(--ink-secondary);}
.chips input{width:14px; height:14px;}
.listedit{display:flex; flex-direction:column; gap:8px;}
.listedit .li{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr) auto; gap:8px; align-items:start;}
.listedit .li.one{grid-template-columns:minmax(0,1fr) auto;}
.listedit .li input, .listedit .li textarea{font:inherit; font-size:13.5px; padding:8px 10px; border-radius:8px; border:1px solid var(--hairline-strong); background:var(--surface); color:var(--ink); width:100%;}
.listedit .li textarea{min-height:38px; resize:vertical;}
.listedit .li .rm{border:none; background:none; color:var(--ink-muted); font-size:20px; cursor:pointer; padding:4px 6px;}
.thumbs{display:grid; grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); gap:10px;}
.thumbs .th{position:relative; border-radius:10px; overflow:hidden; border:1px solid var(--hairline); background:var(--surface-2);}
.thumbs .th img{width:100%; aspect-ratio:16/10; object-fit:cover;}
.thumbs .th input{width:100%; border:none; border-top:1px solid var(--hairline); padding:6px 8px; font:inherit; font-size:12px; background:var(--surface); color:var(--ink);}
.thumbs .th .rm{position:absolute; top:6px; right:6px; width:26px; height:26px; border-radius:50%; border:none; background:rgba(0,0,0,.6); color:#fff; cursor:pointer;}
.comment{padding:10px 12px; border-radius:10px; background:var(--surface-2); font-size:13.5px;}
.comment small{display:block; color:var(--ink-muted); font-size:11.5px; margin-bottom:3px;}
.comment p{margin:0; white-space:pre-wrap; color:var(--ink-secondary);}
.kv{display:grid; grid-template-columns:max-content minmax(0,1fr); gap:6px 16px; font-size:13.5px; margin:0;}
.kv dt{color:var(--ink-muted);} .kv dd{margin:0; color:var(--ink);}
.prose-box{white-space:pre-wrap; background:var(--surface-2); border-radius:10px; padding:12px 14px; font-size:14px; color:var(--ink-secondary); overflow-wrap:anywhere;}
.loading{padding:40px; text-align:center; color:var(--ink-muted);}

@media print{
  .site-nav, .pt-side, .pt-head .acts, .no-print, .toast, footer.site-footer{display:none !important;}
  .pt{display:block;} .pt-main{padding:0;}
  body{background:#fff;}
  .doc-paper{border:none; box-shadow:none; padding:0; max-width:none;}
}
