:root {
  --ink: #101a21;
  --ink-2: #33424d;
  --ink-3: #52606b;
  --muted: #7a858e;
  --line: #e2e6e9;
  --line-2: #eceff1;
  --card: #ffffff;
  --bg: #f4f6f5;
  --brand: #7cc428;
  --brand-mid: #68a31c;
  --brand-ink: #456a0f;
  --brand-wash: #f2f8e4;
  --brand-wash-2: #e1efc5;
  --danger: #b3261e;
  --danger-wash: #fdecea;
  --warn: #b7791f;
  --warn-wash: #fff4dc;
  --radius: 10px;
  --rail-w: 232px;
  --rail-collapsed: 72px;
  --topbar-h: 56px;
  --shadow: 0 1px 2px rgba(16, 26, 33, 0.04), 0 8px 24px rgba(16, 26, 33, 0.04);
  --font-num: "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 14px; }
h3 { font-size: 13px; }
p { margin: 0; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--font-num); font-size: 10.5px; color: var(--muted); }

:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; border-radius: 4px; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ================= layout ================= */
.app { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  position: fixed;
  inset: 0 auto 0 0;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 40;
  transition: width 0.18s ease, flex-basis 0.18s ease;
  overflow: hidden;
}

.main {
  margin-left: var(--rail-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.18s ease;
}

.rail-collapsed .rail { width: var(--rail-collapsed); flex-basis: var(--rail-collapsed); }
.rail-collapsed .main { margin-left: var(--rail-collapsed); }
.rail-collapsed .logo-text,
.rail-collapsed .nav-label,
.rail-collapsed .nav-item span,
.rail-collapsed .nav-count,
.rail-collapsed .rail-toggle span,
.rail-collapsed .rail-foot { display: none; }
.rail-collapsed .nav-item { justify-content: center; padding: 0; }
.rail-collapsed .nav-item.active::before { display: none; }
.rail-collapsed .plate { justify-content: center; padding-left: 0; }
.rail-collapsed .rail-toggle .ico { transform: rotate(180deg); }

.plate { display: flex; align-items: center; gap: 10px; padding: 2px 4px 14px; border-bottom: 1px solid var(--line-2); }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; flex: none;
}
.logo-text { min-width: 0; }
.logo-text b { display: block; font-size: 14px; letter-spacing: -0.01em; }
.logo-text span { display: block; font-size: 10px; color: var(--muted); letter-spacing: 0.04em; white-space: nowrap; }

.rail-toggle {
  display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--muted); font-size: 11.5px; font-family: inherit; cursor: pointer;
}
.rail-toggle:hover { color: var(--ink); border-color: #cfd5d9; }

.nav { display: flex; flex-direction: column; gap: 12px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; color: var(--muted); letter-spacing: 0.08em; padding: 4px 9px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 10px; border-radius: 7px;
  color: var(--ink-2); font-size: 13px; position: relative; white-space: nowrap;
}
.nav-item:hover { background: #f5f8f6; color: var(--ink); }
.nav-item.active { background: var(--brand-wash); color: var(--brand-ink); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-count {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--brand); color: #fff;
  font-size: 10.5px; font-style: normal; display: grid; place-items: center;
}

.rail-foot { border-top: 1px solid var(--line-2); padding-top: 10px; }
.corp { display: flex; gap: 8px; align-items: flex-start; padding: 0 6px; }
.corp .txt b { display: block; font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.corp .txt span { display: block; font-size: 10.5px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); display: inline-block; flex: none; margin-top: 6px; }
.dot.warn { background: var(--warn); }
.dot.brand { background: var(--brand); }
.dot.gray { background: #c3c9cd; }

/* ================= topbar ================= */
.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(8px);
}
.crumb { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.crumb b { color: var(--ink); font-weight: 600; }
.crumb .sep { color: #c3c9cd; }
.crumb-date { font-family: var(--font-num); font-size: 10.5px; }

.search {
  margin-left: auto;
  display: flex; align-items: center; gap: 7px;
  width: min(340px, 32vw); height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #f6f8f7;
  color: var(--muted);
}
.search input {
  border: none; background: transparent; box-shadow: none; min-height: 0; height: 30px;
  padding: 0; width: 100%; font-size: 12.5px; color: var(--ink);
}
.search input:focus { outline: none; box-shadow: none; }
.kbd {
  font-family: var(--font-num); font-size: 9.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; background: #fff; padding: 1px 4px; white-space: nowrap;
}
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--ink-3); cursor: pointer; position: relative; flex: none;
}
.icon-btn:hover { background: #f3f6f4; border-color: var(--line); color: var(--ink); }
.bullet {
  position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); border: 1.5px solid #fff;
}
.me { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--line-2); }
.av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-wash-2);
  color: var(--brand-ink); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none;
}
.who b { display: block; font-size: 12px; font-weight: 600; line-height: 1.3; }
.who span { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.logout-form { margin: 0; }

/* ================= page shell ================= */
.view { padding: 22px 24px 42px; width: 100%; max-width: 1380px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-eye { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }
.page-eye b { color: var(--brand-ink); font-weight: 600; }
.page-eye i { width: 18px; height: 1px; background: var(--line); display: inline-block; }
.page-head h1 { margin-top: 4px; }
.page-head .desc { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 720px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.strong { font-weight: 600; }
.hint { color: var(--muted); font-size: 11.5px; }
.num { font-family: var(--font-num); font-size: 11.5px; }
.nowrap { white-space: nowrap; }

/* ================= buttons / badges ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink-2);
  font-size: 12px; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c9cfd4; color: var(--ink); background: #fdfefd; }
.btn-primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover, .btn.primary:hover { background: var(--brand-mid); border-color: var(--brand-mid); color: #fff; }
.btn-danger { color: var(--danger); border-color: #efc9c5; background: var(--danger-wash); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 11.5px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 999px; background: #f7f9fa;
  color: var(--ink-3); font-size: 11px; white-space: nowrap;
}
.badge.green { background: var(--brand-wash); border-color: var(--brand-wash-2); color: var(--brand-ink); }
.badge.warn { background: var(--warn-wash); border-color: #f0dfbb; color: var(--warn); }
.badge.gray { color: var(--muted); }

/* ================= panels ================= */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2); min-height: 46px;
}
.panel-body { padding: 16px; }
.panel-body.bordered { border-top: 1px solid var(--line-2); }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 12px; }
.empty strong { display: block; color: var(--ink-3); font-size: 13px; font-weight: 500; margin-bottom: 4px; }

.notice { padding: 10px 12px; border-radius: 8px; font-size: 12px; background: var(--brand-wash); border: 1px solid var(--brand-wash-2); color: var(--brand-ink); }
.notice.warn { background: var(--warn-wash); border-color: #f0dfbb; color: var(--warn); }
.notice.danger { background: var(--danger-wash); border-color: #efc9c5; color: var(--danger); }

/* ================= today ================= */
.pushbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.pushbar .cell {
  position: relative; overflow: hidden; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 15px; color: inherit; box-shadow: var(--shadow);
}
.pushbar .cell:hover { border-color: var(--brand-wash-2); background: #fdfffa; }
.pushbar .cell::after {
  content: ""; position: absolute; right: -34px; top: -34px; width: 96px; height: 96px;
  border-radius: 50%; background: var(--brand-wash); opacity: 0.7;
}
.pushbar .k { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); position: relative; z-index: 1; }
.pushbar .n { font-size: 30px; font-weight: 600; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.pushbar .n small { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.pushbar .d { font-size: 11.5px; color: var(--ink-3); margin-top: 7px; line-height: 1.5; position: relative; z-index: 1; }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 14px; align-items: start; }

.brief { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr); }
.brief-lead { padding: 18px 20px; border-right: 1px solid var(--line-2); }
.brief-lead .k { font-size: 11.5px; color: var(--muted); }
.brief-lead .big { font-size: 42px; font-weight: 600; line-height: 1.05; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.brief-lead .big small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { padding: 18px 16px; border-right: 1px solid var(--line-2); }
.metric:last-child { border-right: none; }
.metric .k { font-size: 11.5px; color: var(--muted); }
.metric .v { font-size: 22px; font-weight: 600; margin: 3px 0 4px; font-variant-numeric: tabular-nums; }
.metric .v small { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 2px; }

.feed { display: flex; flex-direction: column; }
.feed .item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--line-2);
}
.feed .item:last-child { border-bottom: none; }
.feed .item.link-item { color: inherit; }
.feed .item.link-item:hover { background: #fbfcfb; }
.feed .title { font-size: 12.5px; font-weight: 500; }
.feed .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.donut-wrap { display: flex; align-items: center; gap: 16px; padding: 16px; }
.donut { width: 120px; height: 120px; border-radius: 50%; position: relative; flex: none; }
.donut::after { content: ""; position: absolute; inset: 17px; background: #fff; border-radius: 50%; }
.donut .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; z-index: 1; }
.donut .center b { font-size: 24px; font-weight: 600; line-height: 1.1; }
.donut .center span { font-size: 10.5px; color: var(--muted); }
.legend { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.legend .row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.legend .row b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend .dot { margin-top: 0; }

.rank { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.rank-row .rank-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); }
.rank-row .rank-top b { font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-row .bar { height: 3px; border-radius: 2px; background: var(--line-2); margin-top: 5px; overflow: hidden; }
.rank-row .bar i { display: block; height: 100%; background: var(--brand); border-radius: 2px; }

.rules { display: flex; flex-direction: column; gap: 8px; }
.rules li { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.rules li span { display: inline-block; min-width: 58px; color: var(--ink-2); font-weight: 500; }

/* ================= tables ================= */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 10.5px; color: var(--muted); font-weight: 500;
  padding: 9px 13px; background: #fafbfb; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 13px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; vertical-align: middle; }
tbody tr:hover td { background: #fbfcfb; }
tr:last-child td { border-bottom: none; }

.summary-strip {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden;
}
.summary-cell { padding: 12px 14px; border-right: 1px solid var(--line-2); }
.summary-cell:last-child { border-right: none; }
.summary-cell span { display: block; font-size: 11px; color: var(--muted); }
.summary-cell b { display: block; font-size: 19px; font-weight: 600; margin-top: 1px; font-variant-numeric: tabular-nums; }

.tabbar { display: flex; gap: 2px; align-items: center; margin-bottom: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; height: 36px; padding: 0 13px;
  color: var(--muted); font-size: 12px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 600; }

/* ================= detail / workbench ================= */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 14px; align-items: start; }

.workbench { display: grid; grid-template-columns: 210px 270px minmax(0, 1fr); gap: 12px; align-items: start; }
.member-pane, .conv-pane { max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.member-list, .conv-list { overflow: auto; }
.member-item { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: inherit; }
.member-item:last-child { border-bottom: none; }
.member-item:hover { background: #fbfcfb; }
.member-item.active { background: var(--brand-wash); }
.member-item .av { width: 28px; height: 28px; font-size: 11px; }
.member-item b { display: block; font-size: 12.5px; font-weight: 500; }
.member-item small { display: block; font-size: 10.5px; color: var(--muted); }

.conv-item { display: block; padding: 11px 13px; border-bottom: 1px solid var(--line-2); color: inherit; }
.conv-item:last-child { border-bottom: none; }
.conv-item:hover { background: #fbfcfb; }
.conv-item.active { background: var(--brand-wash); }
.conv-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.conv-top b { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .preview { font-size: 11px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .meta { font-size: 10px; color: var(--muted); font-family: var(--font-num); margin-top: 3px; }

.msg-pane { min-width: 0; }
.messages { max-height: calc(100vh - 170px); overflow: auto; }
.msg { padding: 11px 16px; border-bottom: 1px solid var(--line-2); }
.msg:last-child { border-bottom: none; }
.msg .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 10.5px; color: var(--muted); }
.msg .who-name { color: var(--ink-2); font-weight: 500; font-size: 11.5px; }
.msg .text { margin-top: 4px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
.msg.recalled .text, .msg.system .text { color: var(--muted); font-style: italic; }
.msg .attach { margin-top: 5px; font-size: 11.5px; }

/* ================= forms ================= */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--ink-3); }
input[type="text"], input[type="password"], input[type="search"], select, textarea {
  font-family: inherit; font-size: 12.5px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  padding: 8px 10px; min-height: 36px; width: 100%;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-wash);
}
.check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.check input { width: auto; min-height: 0; }

/* ================= search ================= */
.search-hero { padding: 16px; margin-bottom: 14px; }
.search-form { display: flex; align-items: center; gap: 8px; }
.search-form .ico { color: var(--muted); margin-left: 4px; }
.search-form input { flex: 1; min-width: 0; }

/* ================= admin ================= */
.admin-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.role-list { max-height: calc(100vh - 230px); overflow: auto; }
.role-item { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--line-2); color: inherit; }
.role-item:last-child { border-bottom: none; }
.role-item:hover { background: #fbfcfb; }
.role-item.active { background: var(--brand-wash); }
.role-item .title { font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.role-item .sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.perm-module { border: 1px solid var(--line-2); border-radius: 8px; margin-bottom: 9px; overflow: hidden; }
.perm-module summary {
  cursor: pointer; padding: 9px 12px; background: #fafbfa; font-size: 12px;
  display: flex; align-items: center; gap: 7px; list-style: none;
}
.perm-module summary::-webkit-details-marker { display: none; }
.perm-module summary::before { content: "›"; color: var(--muted); font-size: 14px; }
.perm-module[open] summary::before { transform: rotate(90deg); }
.perms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 11px 12px; }
.perm { display: flex; align-items: flex-start; gap: 7px; font-size: 11.5px; color: var(--ink-2); }
.perm input { margin-top: 2px; width: auto; min-height: 0; }
.perm .code { display: block; font-family: var(--font-num); font-size: 9.5px; color: var(--muted); }
.perm.disabled { opacity: 0.55; }

.matrix-wrap { overflow-x: auto; border: none; box-shadow: none; border-radius: 0; }
.matrix { min-width: 860px; }
.matrix th, .matrix td { text-align: center; padding: 7px 10px; font-size: 11px; }
.matrix th:first-child, .matrix td:first-child { text-align: left; width: 34%; }
.matrix th .code { display: block; font-weight: 400; }
.matrix .module-row td { background: #fafbfb; font-weight: 600; color: var(--ink-2); font-size: 11.5px; }
.matrix .perm-name { font-size: 11.5px; color: var(--ink-2); }
.matrix .yes { color: var(--brand-ink); font-weight: 700; }
.matrix .no { color: #c9cfd4; }

/* ================= modal / login ================= */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 26, 33, 0.42);
  display: grid; place-items: center; padding: 18px; z-index: 60;
}
.modal { width: min(460px, 100%); background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22); overflow: hidden; }
.modal .body { padding: 18px; }
.modal .foot { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 22px;
  background: radial-gradient(900px 460px at 50% -10%, #eaf5d8 0%, var(--bg) 62%);
}
.login-card {
  width: min(390px, 100%); background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 26px;
}
.login-card .desc { color: var(--muted); font-size: 12px; margin: 5px 0 18px; }
.login-plate { border-bottom: none; padding: 0 0 16px; margin-bottom: 2px; }
.login-card .notice { margin-bottom: 12px; }
.login-card .btn { width: 100%; min-height: 42px; }

/* ================= responsive ================= */
@media (max-width: 1180px) {
  .workbench { grid-template-columns: 190px 240px minmax(0, 1fr); }
  .grid-main { grid-template-columns: minmax(0, 1.4fr) minmax(250px, 1fr); }
}

@media (max-width: 980px) {
  .grid-main { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .workbench { grid-template-columns: 1fr; }
  .member-pane, .conv-pane { max-height: 240px; }
  .messages { max-height: none; }
  .admin-grid { grid-template-columns: 1fr; }
  .role-list { max-height: 260px; }
  .summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-cell:nth-child(3n) { border-right: none; }
}

@media (max-width: 760px) {
  .app { display: block; }
  .rail {
    position: sticky; top: 0; width: auto; flex-basis: auto; height: auto;
    padding: 8px 10px; border-right: none; border-bottom: 1px solid var(--line);
    z-index: 50; overflow: visible;
  }
  .plate, .rail-toggle, .rail-foot, .nav-label { display: none !important; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .nav-group { flex-direction: row; gap: 4px; }
  .nav-item { height: 42px; padding: 0 12px; white-space: nowrap; border: 1px solid transparent; }
  .nav-item.active { border-color: var(--brand-wash-2); }
  .nav-item.active::before { display: none; }
  .nav-count { margin-left: 2px; }
  .rail-collapsed .main { margin-left: 0; }
  .main { margin-left: 0; }
  .topbar {
    height: auto; min-height: 52px; padding: 8px 13px 10px; flex-wrap: wrap; gap: 8px;
    position: static;
  }
  .crumb { order: 1; font-size: 10.5px; }
  .me { order: 2; margin-left: auto; padding-left: 0; border-left: none; }
  .who span { display: none; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .kbd { display: none; }
  .view { padding: 14px 13px 34px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 19px; }
  .pushbar { grid-template-columns: 1fr; }
  .brief { grid-template-columns: 1fr; }
  .brief-lead { border-right: none; border-bottom: 1px solid var(--line-2); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { border-right: none; border-bottom: 1px solid var(--line-2); }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .stack-mobile { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-cell { padding: 10px 11px; }
  .summary-cell b { font-size: 17px; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 620px; }
  .perms { grid-template-columns: 1fr; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 38px; }
  .icon-btn { width: 42px; height: 42px; }
}
