:root {
  --bg: #121b26;
  --bg2: #0f1720;
  --panel: #1a2836;
  --panel2: #1e2e3d;
  --item: #233444;
  --item-hi: #2a3d50;
  --line: #2c3a48;
  --deep: #0d141c;
  --text: #e8edf2;
  --muted: #8c99a6;
  --dlg: #1f1f1f;
  --dlg-in: #2a2a2a;
  --accent: #3b8ee8;
  --red: #ff0000;
  --radius: 10px;
  --font: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: transparent; font-family: var(--font); color: var(--text); font-size: 14px; overflow: hidden; user-select: none; }
body { background: transparent; }
input, textarea, select, button { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2d3e50; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* MDW window: ~74% x 72% of the screen, a bit above center (the game stays visible around it) */
:root { --win-l: 12.6vw; --win-t: 11.2vh; --win-w: 73.8vw; --win-h: 71.6vh; }
#app { position: fixed; left: var(--win-l); top: var(--win-t); width: var(--win-w); height: var(--win-h); border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 30px 80px rgba(0, 0, 0, .6);
  background: radial-gradient(1200px 700px at 30% 0%, #16212e 0%, var(--bg) 55%, var(--bg2) 100%); display: none; flex-direction: column; transition: opacity .18s ease; }
#app.open { display: flex; }
/* web (browser) version: full page */
body.web { background: var(--bg2); }
body.web #app, body.web #dialogs { left: 0; top: 0; width: 100vw; height: 100vh; border-radius: 0; }
body.web { --win-w: 100vw; }
#app.locked #top, #app.locked #tabs { display: none; }
.web-lock { max-width: 460px; margin: 60px auto; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.web-lock img { width: 110px; }
.wl-title { font-size: 24px; font-weight: 800; }
.wl-text { font-size: 15px; color: #e3e8ec; }
@media (max-width: 760px) {
  body.web #top { height: auto; flex-wrap: wrap; gap: 8px; padding: 10px; }
  body.web .search-box { width: calc(100vw - 110px); }
  body.web #me { display: none; }
  body.web .cols3, body.web .cols2, body.web .dash, body.web .docs-layout { grid-template-columns: 1fr; }
  body.web .penal-row { grid-template-columns: 1fr; }
  body.web .grid2 { grid-template-columns: 1fr; }
}
/* eye button: keep the MDW see-through */
#app.ghost { opacity: .45; }
#btn-ghost { font-size: 17px; color: #8f9ba7; }
#btn-ghost.on { color: #fff; background: rgba(59, 142, 232, .25); }

/* ---------------------------------------------------------------- top bar */
#top { height: 96px; display: flex; align-items: flex-start; justify-content: space-between; padding: 14px 18px 0 18px; flex-shrink: 0; }
#searchbar { position: relative; display: flex; align-items: center; gap: 6px; }
.top-btn { background: none; border: 0; color: #d9e1e8; font-size: 20px; width: 34px; height: 40px; display: grid; place-items: center; border-radius: 6px; }
.top-btn:hover { background: rgba(255, 255, 255, .05); }
.search-box { position: relative; width: 420px; }
.search-box input { width: 100%; height: 42px; background: #1b2632; border: 0; border-radius: 6px; padding: 0 40px 0 14px; outline: none; font-size: 13px; }
.search-box input::placeholder { color: #9aa6b2; }
.search-box i { position: absolute; right: 14px; top: 13px; color: #8693a0; font-size: 13px; }
#me { display: flex; align-items: center; gap: 22px; font-weight: 700; font-size: 16px; color: #dfe6ec; }
#logo { width: 86px; height: 86px; object-fit: contain; margin-top: -6px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }

/* ---------------------------------------------------------------- search popover */
#search-pop { display: none; position: absolute; left: -10px; top: -6px; width: min(1040px, calc(var(--win-w) - 16px)); z-index: 50; background: #1b2a38; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .55); padding: 74px 14px 14px; }
#search-pop.open { display: block; }
#searchbar > .top-btn, #searchbar > .search-box { position: relative; z-index: 51; }
#search-pop.open ~ * { z-index: 51; }
.sr-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.sr-filters .field, .sr-filters .multi { background: #172430; }
.sr-main { display: flex; min-height: 420px; max-height: 60vh; }
.sr-side { width: 244px; flex-shrink: 0; padding: 2px 0; overflow-y: auto; }
.sr-cat { padding: 11px 16px; font-weight: 700; font-size: 16px; border-radius: 8px 0 0 8px; cursor: pointer; color: #e9eef3; }
.sr-cat:hover { background: rgba(255, 255, 255, .03); }
.sr-cat.on { background: var(--deep); }
.sr-results { flex: 1; background: var(--deep); border-radius: 0 10px 10px 10px; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.sr-hint { margin: auto; color: #e3e8ec; }
.sr-card { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #1e2f40, #1a2938); border-radius: 10px; padding: 14px 16px; cursor: pointer; transition: background .12s; }
.sr-card:hover { background: linear-gradient(135deg, #24384c, #1e3042); }
.sr-card.report { align-items: flex-end; }
.sr-text { flex: 1; min-width: 0; }
.sr-title { font-weight: 700; font-size: 17px; }
.sr-sub { color: #c8d0d8; font-size: 12px; margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; }
.sr-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------------------------------------------------------- tabs */
#tabs { display: flex; align-items: flex-end; gap: 6px; padding: 0 10px; border-bottom: 1px solid #3a4756; height: 46px; flex-shrink: 0; overflow-x: auto; overflow-y: hidden; }
.tab { position: relative; width: 200px; flex-shrink: 0; height: 40px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; padding: 4px 26px 4px 26px; cursor: pointer; display: flex; align-items: center; color: #9aa5b0; }
.tab:hover { color: #d7dee4; }
.tab.active { border-color: #3a4756; background: var(--bg); color: #fff; margin-bottom: -1px; height: 41px; }
.tab.dragging { opacity: .4; }
.tab .grip { position: absolute; left: 10px; top: 13px; font-size: 11px; color: #4b5866; }
.tab-text { min-width: 0; }
.tab-title { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-sub { font-size: 11px; color: #8592a0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.tab-x { position: absolute; right: 8px; top: 13px; font-size: 11px; color: #6b7886; opacity: 0; }
.tab:hover .tab-x { opacity: 1; }
.tab-x:hover { color: #fff; }

/* ---------------------------------------------------------------- page layouts */
#page { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }
.loading { display: grid; place-items: center; height: 200px; color: var(--muted); font-size: 22px; }
.page-error { margin: 40px auto; text-align: center; color: #ff8a8a; }
.page-pad { padding: 12px 10px 30px; }
.page-pad.narrow, .stack.narrow { max-width: 860px; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding: 12px 10px 30px; align-items: start; }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 12px 10px 30px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.col.grow { flex: 1; }
.with-rail { display: flex; min-height: 100%; }
.with-rail > :first-child { flex: 1; min-width: 0; }
.profile-body { flex: 1; min-width: 0; }
.rail { width: 44px; flex-shrink: 0; background: #111a24; display: flex; flex-direction: column; align-items: center; padding-top: 14px; gap: 8px; }
.rail-btn { background: none; border: 0; color: #c9d2da; font-size: 19px; width: 36px; height: 36px; border-radius: 8px; }
.rail-btn:hover { background: rgba(255, 255, 255, .06); }
.rail-btn.on { color: #fff; background: rgba(255, 255, 255, .08); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.trash-row { grid-template-columns: 1fr 1fr auto; align-items: center; }
.grid3.trash-row { grid-template-columns: 1fr 1fr 1fr auto; }
.docs-layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; padding: 12px 10px 30px; align-items: start; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- cards */
.card { background: linear-gradient(135deg, #1d2d3d 0%, #182634 100%); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); padding: 14px 13px; display: flex; flex-direction: column; gap: 10px; }
.card.flat { padding: 0; background: none; box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 22px; }
.card-title { font-weight: 700; font-size: 17px; color: #f1f4f7; }
.card-body { display: flex; flex-direction: column; gap: 10px; }
.card-body:empty { display: none; }
.dots, .burger, .icon-btn { background: none; border: 0; color: #c2cbd4; width: 30px; height: 26px; border-radius: 6px; display: grid; place-items: center; }
.burger { font-size: 18px; }
.dots:hover, .burger:hover, .icon-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.empty-note { color: var(--muted); font-size: 13px; padding: 4px 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; user-select: text; line-height: 1.45; }
.click { cursor: pointer; }
.kv { display: flex; flex-direction: column; gap: 4px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv span { color: var(--muted); }
.f-caption { font-weight: 700; font-size: 13px; color: #cfd7de; margin-top: 4px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; background: #101922; color: #f1f4f7; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; line-height: 1.2; max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; }
.chip.click { cursor: pointer; }
.chip.click:hover { filter: brightness(1.2); }
.chip.red { background: #7f1d1d; }
.chip.green { background: #14532d; }
.chip.amber { background: #78350f; }
.chip.dim { opacity: .55; }
.chip.expunged { opacity: .45; text-decoration: line-through; }
.sr-chips .chip { background: #2b3b4b; border-radius: 6px; padding: 4px 9px; }

/* avatars */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar.empty { display: grid; place-items: center; font-size: 34px; color: #5a6672; }
.avatar.big { width: 64px; height: 64px; }
.avatar.empty.big { font-size: 64px; }
.pic-wrap { display: grid; place-items: center; min-height: 150px; }
.profile-pic { max-width: 100%; max-height: 260px; border-radius: 8px; object-fit: contain; }
.pic-switch { display: flex; gap: 6px; justify-content: center; }
.name-card { min-height: 230px; }

.warrant-bar { background: var(--red); border-radius: var(--radius); padding: 14px 13px; font-weight: 700; font-size: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.wb-sub { font-weight: 600; font-size: 12px; opacity: .9; }
.icu-bar { background: #7c2d12; border-radius: 8px; padding: 8px 10px; font-weight: 700; }

/* notes */
.notes { display: flex; flex-direction: column; gap: 8px; }
.note { background: #142029; border-radius: 8px; padding: 8px 10px; }
.note.contact { cursor: pointer; }
.note-head { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid #2b3946; font-size: 13px; }
.note-author { font-weight: 600; }
.note-author.big { font-weight: 700; font-size: 15px; }
.note-author i { font-size: 11px; background: #2a3846; border-radius: 50%; width: 22px; height: 22px; display: inline-grid; place-items: center; }
.note-time { margin-left: auto; color: #b8c2cc; font-size: 11px; }
.note-del { color: #8a96a2; cursor: pointer; font-size: 11px; }
.note-del:hover { color: #ff7b7b; }
.note-text { padding-top: 8px; white-space: pre-wrap; user-select: text; font-size: 13px; }

/* rows */
.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; background: #142029; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.row.click:hover, .row.on { background: #1d2c3a; }
.row.dim { opacity: .6; }
.row-right { margin-left: auto; }
.row.hist { flex-wrap: wrap; gap: 4px; }
.plate { font-family: 'Consolas', monospace; background: #e9edf1; color: #12304f; padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* ---------------------------------------------------------------- dashboard */
.dash { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding: 18px 8px; }
.dash-title { font-weight: 700; font-size: 16px; margin: 0 0 12px 8px; }
.dash-list { display: flex; flex-direction: column; gap: 12px; }
.dash-card { background: linear-gradient(135deg, #1e3043, #1a2a3a); border-radius: var(--radius); padding: 14px 13px; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.dash-card:hover { filter: brightness(1.08); }
.dash-card.person { background: linear-gradient(135deg, #172433, #142030); min-height: 210px; }
.dc-title { font-weight: 700; font-size: 16px; }
.dc-sub { font-size: 12.5px; margin-top: 3px; }
.dc-time { font-size: 12px; margin-bottom: 4px; }
.dc-avatar { display: grid; place-items: center; padding-top: 22px; }
.dash .empty-note { padding-left: 8px; }

/* ---------------------------------------------------------------- managers */
.mgr-list { display: flex; flex-direction: column; gap: 14px; }
.mgr-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: linear-gradient(135deg, #273a4c, #22323f); border-radius: 10px; padding: 14px 12px; min-height: 56px; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); }
.mgr-item.click { cursor: pointer; }
.mgr-item.on { outline: 1px solid #4b6a88; }
.mgr-label { font-size: 14px; min-width: 0; }
.mgr-label .muted { margin-left: 10px; }
.sub-item { padding-left: 26px; margin-top: -6px; }
.perm-list { display: flex; flex-direction: column; gap: 4px; }
.cols3.roles { grid-template-columns: 1fr 1fr 1fr; }
.btn.wide { width: 100%; margin-top: 6px; }

/* penal code */
.penal { padding: 18px 22px; }
.penal-title { font-size: 26px; margin-bottom: 4px; }
.penal-row { display: grid; grid-template-columns: 200px 300px 1fr; gap: 16px; background: linear-gradient(135deg, #273a4c, #22323f); border-radius: 12px; padding: 14px 22px; font-size: 18px; }
.pn-nums { display: flex; flex-direction: column; gap: 4px; color: #b9c3cc; }
.pn-nums div { white-space: nowrap; }
.pn-name .muted { font-size: 17px; padding-left: 12px; margin-top: 4px; }
.pn-desc { user-select: text; line-height: 1.5; }

/* ---------------------------------------------------------------- reports */
.report-head .rh-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.rh-title { font-weight: 700; font-size: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rh-title.click:hover { text-decoration: underline; text-decoration-color: #4d5c6b; }
.flag-row { display: flex; flex-direction: column; gap: 2px; }
.autopsy .au-title { font-size: 20px; font-weight: 700; }
.people { display: flex; flex-direction: column; gap: 10px; }
.person-row { display: flex; align-items: center; gap: 10px; background: #142029; border-radius: 8px; padding: 6px 10px; }
.person-row .avatar { width: 30px; height: 30px; }
.person-row .avatar.empty { font-size: 26px; }
a { color: #e8edf2; cursor: pointer; font-weight: 700; }
a:hover { text-decoration: underline; }
.suspect { background: #142029; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.suspect.click:hover { background: #172533; }
.sus-head { display: flex; align-items: center; gap: 10px; }
.sus-head .avatar { width: 30px; height: 30px; }
.sus-head .avatar.empty { font-size: 26px; }
.sus-head .dots { margin-left: auto; }
.online { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.sus-charges { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-radius: 8px; background: #0f1820; min-height: 38px; align-items: center; }
.sus-charges.click:hover { outline: 1px dashed #3d5266; }
.sus-totals { font-size: 12.5px; color: #c4ccd4; }
.evidence { display: flex; flex-direction: column; gap: 8px; }
.ev { position: relative; background: #142029; border-radius: 8px; padding: 8px 10px; }
.ev img { max-width: 100%; max-height: 220px; border-radius: 6px; cursor: zoom-in; display: block; }
.ev-label { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.ev-x { position: absolute; right: 8px; top: 8px; cursor: pointer; color: #8a96a2; }
.ev-x:hover { color: #fff; }
.ev-full { max-width: 100%; max-height: 75vh; display: block; margin: auto; }
.attached { background: #142029; border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.att-head { display: flex; justify-content: space-between; align-items: center; }

/* charge picker */
.charges-edit { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; min-height: 420px; }
.ce-left, .ce-right { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.charge-pick { overflow-y: auto; max-height: 52vh; display: flex; flex-direction: column; gap: 3px; }
.cp-head { font-weight: 800; font-size: 13px; color: #b6c0ca; margin: 8px 0 2px; }
.cp-row { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 6px; background: #262626; cursor: pointer; font-size: 13px; }
.cp-row:hover { background: #313131; }
.picked { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 46vh; }
.picked-row { display: flex; align-items: center; gap: 8px; background: #262626; border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.pr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sel { background: #1a1a1a; border: 1px solid #3a3a3a; border-radius: 4px; padding: 2px 4px; }
.counter { display: inline-flex; align-items: center; gap: 6px; }
.counter button { width: 22px; height: 22px; border: 0; border-radius: 4px; background: #3a3a3a; }

/* ---------------------------------------------------------------- rich text */
.rte { background: #101922; border-radius: 8px; }
.dlg .rte { background: #161616; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 6px 4px; position: sticky; top: -14px; z-index: 2; background: inherit; border-radius: 8px 8px 0 0; }
.dlg .rte-bar { background: #161616; }
.card .rte-bar { background: #101922; }
.rte-btn { background: none; border: 0; color: #8e9aa6; width: 30px; height: 28px; border-radius: 5px; }
.rte-btn:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.rte-sep { width: 14px; }
.rte-area { min-height: 140px; padding: 10px; outline: none; user-select: text; line-height: 1.5; overflow-wrap: anywhere; }
.rte.readonly .rte-area { min-height: 40px; }
.rte-area.view { min-height: 0; padding: 4px 0; }
.rte-area img { max-width: 100%; border-radius: 6px; }
.rte-area p { margin: 0 0 4px; }
.rte-area h1, .rte-area h2, .rte-area h3 { margin: 6px 0; }
.rte-area blockquote { border-left: 3px solid #3d5266; margin: 6px 0; padding: 2px 10px; color: #c3ccd5; }
.rte-area hr { border: 0; border-top: 1px solid #3a4756; }
.rte-area table, .rte-table { border-collapse: collapse; width: 100%; margin: 6px 0; }
.rte-area td { border: 1px solid #3a4756; padding: 4px 8px; }
.rte-area ul.checklist { list-style: none; padding-left: 4px; }

/* ---------------------------------------------------------------- form fields */
.field { position: relative; display: flex; flex-direction: column; justify-content: center; background: #1b2834; border-radius: 6px; min-height: 48px; padding: 6px 13px; cursor: text; border: 1px solid transparent; }
.dlg .field { background: var(--dlg-in); }
.field.focus { border-color: var(--accent); }
.field .f-label { color: #e0e6eb; font-size: 14px; transition: font-size .12s; pointer-events: none; }
.field input, .field textarea, .field select { background: transparent; border: 0; outline: none; padding: 0; width: 100%; font-size: 14px; color: #fff; }
.field textarea { resize: vertical; min-height: 40px; line-height: 1.4; }
.field input, .field textarea { height: 0; opacity: 0; }
.field.filled .f-label { font-size: 11.5px; margin-bottom: 2px; }
.field.filled input, .field.filled textarea { height: auto; opacity: 1; }
.field.select select { appearance: none; cursor: pointer; padding-right: 22px; }
.field.select option { background: #222; }
.field .f-adorn { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #8a96a2; pointer-events: none; }
.field .f-adorn.click { pointer-events: auto; cursor: pointer; }
.color-pick { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.field input[type=datetime-local] { color-scheme: dark; }
.field.image { cursor: pointer; outline: none; }
.field.image .img-prev { display: none; max-height: 90px; max-width: 100%; border-radius: 4px; margin-top: 4px; object-fit: contain; align-self: flex-start; }
.field.image.has .img-prev { display: block; }
.field.image .img-hint { display: none; font-size: 11px; color: var(--muted); }
.field.image.focus .img-hint { display: block; }
.field.image .img-clear { display: none; position: absolute; right: 10px; top: 10px; color: #8a96a2; }
.field.image.has .img-clear { display: block; }

.multi { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; background: #1b2834; border-radius: 6px; padding: 6px 34px 6px 10px; cursor: pointer; border: 1px solid #253442; }
.dlg .multi { background: #1d1d1d; border-color: #333; }
.m-ph { color: #8f9ba7; font-size: 13.5px; }
.m-caret { position: absolute; right: 12px; color: #c6ced6; font-size: 12px; }
.mchip { display: inline-flex; align-items: center; gap: 6px; background: #3a3f4f; border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12px; font-weight: 700; }
.mchip i { cursor: pointer; color: #cfd6dd; font-size: 15px; }

.check { display: flex; align-items: center; gap: 12px; padding: 4px 2px; cursor: pointer; }
.check input { display: none; }
.check .box { width: 26px; height: 26px; border-radius: 4px; background: #33404d; display: grid; place-items: center; flex-shrink: 0; }
.dlg .check .box { background: #3a3a3a; }
.check .box i { color: #fff; font-size: 15px; display: none; }
.check input:checked + .box i { display: block; }
.check input:disabled ~ * { opacity: .6; cursor: default; }
.check .c-label { color: #9aa6b1; font-size: 13.5px; }
.check input:checked ~ .c-label { color: #eef2f5; }

/* buttons */
.btn { background: #1a1a1a; border: 0; border-radius: 6px; padding: 10px 16px; color: #b9bec4; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.card .btn { background: #142029; color: #dfe5ea; }
.btn:hover { color: #fff; filter: brightness(1.25); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.ghost { background: transparent; border: 1px solid #3a3a3a; }
.btn.danger { background: #5b1414; color: #ffd1d1; }

/* ---------------------------------------------------------------- menus */
.menu { position: fixed; z-index: 200; min-width: 214px; background: #1b2532; border-radius: 6px; padding: 4px 0; box-shadow: 0 12px 34px rgba(0, 0, 0, .55); border: 1px solid #263343; }
.menu.scroll { max-height: 320px; overflow-y: auto; }
.menu.sub { position: absolute; left: 100%; top: -5px; }
.menu.sub.left { left: auto; right: 100%; }
.menu-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 10px; cursor: pointer; font-size: 13px; color: #e7ecf0; white-space: nowrap; }
.menu-item:hover { background: rgba(255, 255, 255, .06); }
.menu-item.disabled { opacity: .4; cursor: default; }
.mi-icon { width: 18px; text-align: center; color: #c7d0d8; font-size: 13px; }
.mi-label { flex: 1; }
.mi-arrow { font-size: 10px; color: #9aa6b2; margin-left: 10px; }
.menu-div { height: 1px; background: #3a4756; margin: 6px 12px; }
.menu-head { padding: 6px 14px; font-size: 11px; color: var(--muted); text-transform: uppercase; }

/* ---------------------------------------------------------------- dialogs */
#dialogs { position: fixed; left: var(--win-l); top: var(--win-t); width: var(--win-w); height: var(--win-h); pointer-events: none; z-index: 150; }
.dlg-bg { border-radius: 12px; }
.dlg-bg { position: absolute; inset: 0; background: rgba(5, 8, 12, .45); display: flex; align-items: center; justify-content: center; pointer-events: auto; }
.dlg { width: 790px; max-width: calc(100% - 24px); max-height: calc(100% - 24px); min-height: 0; background: var(--dlg); border-radius: 10px; box-shadow: 0 24px 70px rgba(0, 0, 0, .6); display: flex; flex-direction: column; border: 1px solid #2b2b2b; }
.dlg.wide { width: 1000px; }
.dlg.xl { width: 1500px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px 12px; border-bottom: 1px solid #333; }
.dlg-title { font-size: 20px; font-weight: 700; }
.dlg.big-title .dlg-title { font-size: 30px; }
.dlg-head, .dlg-foot { flex-shrink: 0; }
.dlg-body > * { flex-shrink: 0; } /* long content must not be squeezed (it would overlap the next part) */
.dlg-body > .rte-area.view { background: #161616; border-radius: 8px; padding: 10px 12px; }
/* only the middle scrolls: Cancel / Submit always stay visible, however long the text gets */
.dlg-body { flex: 1 1 auto; min-height: 0; padding: 14px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; user-select: text; }
.dlg-foot { display: flex; justify-content: space-between; padding: 12px 20px 16px; border-top: 1px solid #333; }
.dlg-text { color: #d9dfe4; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.pick-row { padding: 9px 12px; border-radius: 6px; background: #262626; cursor: pointer; }
.pick-row:hover { background: #333; }
.blocking-notice .dlg-title { color: #ff6b6b; }

/* ---------------------------------------------------------------- toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 300; pointer-events: none; }
.toast { background: #1b2532; border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); display: flex; gap: 10px; align-items: center; font-size: 13px; transition: opacity .3s, transform .3s; }
.toast.error { border-color: #ef4444; }
.toast.error i { color: #ef4444; }
.toast.success { border-color: #22c55e; }
.toast.success i { color: #22c55e; }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 1300px) {
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols3, .cols3.roles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .penal-row { grid-template-columns: 150px 220px 1fr; font-size: 15px; }
}
