:root {
  --blue: #2e7fd6;
  --navy: #1b5aa3;
  --accent: #ffc94a;
  --tint: #eaf3fd;
  --bg: #eef3f8;
  --card: #fff;
  --ink: #111;
  --muted: #777;
  --line: #e3eaf2;
  --green-bg: #e5f6ec;
  --green: #146c43;
  --amber-bg: #fff4d6;
  --amber: #6a4b00;
  --red-bg: #fdecec;
  --red: #8e2436;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --side: 232px;
  --shadow-pop: 0 18px 40px rgba(26, 39, 68, 0.16);
  --font: "Instrument Sans", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--accent);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  z-index: 20;
}
.skip:focus { top: 12px; }

.boot { padding: 48px 20px; color: var(--muted); }

.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(260px, 42%) 1fr;
}
.login-brand {
  background: var(--navy);
  color: #fff;
  padding: clamp(28px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
}
.login-brand h1 {
  margin: 12px 0 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 12ch;
}
.login-brand p:last-child { margin: 0; max-width: 36ch; color: #e7f1fb; }
.brandline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--accent);
  display: inline-block;
}
.login-form {
  display: grid;
  align-content: center;
  padding: clamp(24px, 5vw, 64px);
}
.login-form form, dialog form { display: grid; gap: 12px; }
.login-form h2, dialog h2 { margin: 0 0 4px; letter-spacing: -0.02em; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
.login-form button[type="submit"], dialog button[type="submit"] {
  background: var(--accent);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 700;
}
.primary {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 8px;
  min-height: 36px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
}
.primary:hover { background: var(--navy); }
.login-form button[type="submit"] { margin-top: 4px; }

.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--side) 1fr;
}
.side {
  background: #fff;
  color: var(--ink);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 16px 12px;
}
.side :focus-visible { outline-color: var(--navy); }
.side-top { display: flex; align-items: center; gap: 8px; padding: 2px 4px 16px; height: 50px; }
.collapse-chevron {
  width: 26px;
  height: 26px;
  margin-left: auto;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  display: grid;
  place-items: center;
  padding: 0;
  flex: none;
}
.collapse-chevron:hover { background: var(--tint); }
.collapse-chevron svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.side-top .brandline { flex: 1; min-width: 0; }
.brand-text { color: var(--navy); font-size: 17px; }
.brand-dot { color: var(--accent); }
.side-close, .menu-btn { display: none; }
.ws { position: relative; padding: 0 0 8px; }
.ws-btn {
  width: 100%;
  text-align: left;
  background: #f7fafe;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 44px;
}
.ws-btn:hover { background: var(--tint); }
.ws-kicker { display: block; font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.2; }
#ws-label { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-menu, .search-menu {
  position: absolute;
  z-index: 5;
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  max-height: 320px;
  overflow: auto;
}
.ws-menu { left: 12px; right: 12px; top: calc(100% - 4px); }
.ws-menu button, .search-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 40px;
}
.ws-menu button[aria-current="true"], .ws-menu button:hover, .search-menu button:hover { background: var(--tint); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0; overflow: auto; flex: 1; min-height: 0; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9aa5b5; padding: 12px 11px 4px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 9px;
  min-height: 36px;
  padding: 7px 11px;
  font-weight: 600;
  font-size: 13px;
}
.nav button:hover { background: var(--tint); color: var(--navy); }
.nav button svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav button[aria-current="page"] { background: var(--tint); color: var(--navy); }
.side-foot { margin-top: auto; padding: 8px 0 0; display: grid; gap: 4px; }
.mono-card { padding: 12px; border-radius: 12px; background: var(--tint); font-size: 12px; line-height: 1.4; color: var(--navy); font-weight: 500; }
.mono-card strong { display: block; margin-top: 4px; font-size: 16px; font-weight: 700; }
.mono-track { height: 5px; border-radius: 3px; background: #fff; margin-top: 8px; }
.mono-track span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--blue); }
.userline {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 4px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  min-height: 44px;
}
.userline:hover { background: #f2f2f2; }
.user-meta { font-size: 12px; line-height: 1.3; min-width: 0; }
.user-meta strong { display: block; font-weight: 600; color: var(--ink); }
.user-meta span { color: #777; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #5a3e00; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.workspace { min-width: 0; display: flex; flex-direction: column; background: #fff; }
.top {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 280px) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 3;
}
.top-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-title > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.sub { margin: 0; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: var(--tint); color: var(--navy); white-space: nowrap; }
.search { position: relative; }
.search input { background: #fff; min-height: 44px; }
.search-menu { left: 0; right: 0; top: calc(100% + 6px); }
.search-menu .group { padding: 6px 8px 2px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.search-menu small { display: block; color: var(--muted); font-weight: 500; }
.primary { white-space: nowrap; }
main { padding: 16px 24px 32px; background: #fff; }
.banner {
  background: var(--red-bg);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 12px;
}
.hint { margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; }
.empty {
  margin: 0;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 16px;
}
.card + .card, .stack > * + * { margin-top: 12px; }
.row-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.row-cards .card { margin-top: 0; }
button.card { width: 100%; text-align: left; }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--tint); color: var(--navy); }
.actions, .sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
h2 { font-size: 16px; letter-spacing: -0.02em; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 18px 0 8px;
}
.section-head h2 { margin: 0; font-size: 16px; letter-spacing: -0.02em; }
.grid-4, .grid-2, .grid-3 { display: grid; gap: 12px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat strong { display: block; margin-top: 4px; font-size: 22px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; border: 1px solid #eee; border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; text-align: left; vertical-align: middle; }
th { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: #fafafa; }
tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.click td { cursor: pointer; }
.click:hover td { background: var(--tint); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f6;
  color: var(--muted);
}
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-blue { background: var(--tint); color: var(--navy); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-slate { background: #eef2f6; color: var(--muted); }
.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip, .ghost {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 36px;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 13px;
}
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.ghost { color: var(--navy); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.progress {
  height: 8px;
  background: var(--tint);
  border-radius: 99px;
  overflow: hidden;
}
.progress span { display: block; height: 100%; background: var(--blue); }
.bar-row { display: grid; grid-template-columns: 88px 1fr auto; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.bar { height: 10px; background: var(--tint); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--navy); }
.cal-scroll { overflow: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 8px; min-width: 840px; }
.cal-day {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 140px;
  padding: 8px;
}
.cal-day header { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 700; }
.cal-day.quiet { background: #f7fbfe; }
.cal-post {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: var(--tint);
  padding: 6px;
  margin-top: 6px;
  font-size: 12px;
}
.cal-post strong { font-size: 12px; }
.cal-post.held { background: var(--amber-bg); }
.month-grid .cal-day { min-height: 92px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 10px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }
.person { text-align: left; width: 100%; }
.matrix { display: grid; gap: 0; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.matrix-row { display: grid; grid-template-columns: minmax(160px, 1.4fr) repeat(4, 56px); gap: 8px; align-items: center; font-size: 13px; padding: 8px 12px; border-bottom: 1px solid #f0f4f8; }
.matrix-row:last-child { border-bottom: 0; }
.matrix-head { background: #f7fafc; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.matrix-head span:not(:first-child), .matrix-row .cell { justify-self: center; }
.matrix-row small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.matrix-row code, .tool-table code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--navy); }
.matrix-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.matrix-legend span { display: inline-flex; align-items: center; gap: 6px; }
.matrix-legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.matrix-legend .sw.ok { background: var(--blue); }
.matrix-legend .sw.ap { background: #ffc94a; }
.matrix-legend .sw.no { background: #eee; border: 1px solid #ddd; }
.mcp-page { display: grid; gap: 14px; }
.lead { margin: 0; max-width: 72ch; font-size: 13px; line-height: 1.5; color: #555; }
.mode-bar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px; background: #111; color: #fff; }
.mode-bar p { margin: 0; flex: 1; font-size: 13px; }
.mode-bar p span { color: #bbb; font-weight: 500; }
.mode-bar .seg { display: flex; background: #2a2a2a; border-radius: 8px; padding: 3px; gap: 2px; }
.mode-bar .chip { background: transparent; color: #bbb; border: 0; min-height: 32px; }
.mode-bar .chip[aria-pressed="true"] { background: #fff; color: #111; }
.mode-bar .ghost { color: #fff; border-color: #444; background: transparent; }
.mcp-page h2 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.mcp-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 14px; align-items: start; }
.mcp-split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .85fr); gap: 14px; align-items: start; }
.mcp-split .table-wrap { border: 0; border-radius: 0; }
.conn-list { display: grid; gap: 8px; }
.conn-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid #f0f0f0; background: #fff; }
.conn-row.on { border-color: var(--blue); background: var(--tint); }
.conn-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.conn-copy { min-width: 0; display: grid; }
.conn-copy small, .conn-meta { color: var(--muted); font-size: 12px; font-weight: 500; }
.conn-copy small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-meta { text-align: right; white-space: nowrap; }
.tool-table { width: 100%; border-collapse: collapse; }
.tool-table th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; background: #f7fafc; }
.tool-table td { padding: 10px; border-top: 1px solid #f0f4f8; vertical-align: middle; }
.tool-table td:last-child, .tool-table th:last-child { text-align: right; width: 140px; }
.tool-table .badge { white-space: nowrap; }
@media (max-width: 980px) {
  .mcp-layout, .mcp-split { grid-template-columns: 1fr; }
  .mode-bar { flex-wrap: wrap; }
}
.cell {
  width: 36px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}
.cell.ok { background: #2e7fd6; color: #fff; border-color: #2e7fd6; }
.cell.ap { background: #fff3cc; color: #5a3e00; border-color: #ffc94a; }
.cell.no { background: #f5f5f5; color: #aaa; border-color: #ddd; }
.check-row { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; color: var(--ink); }
.check-row input { width: auto; margin-top: 3px; }
.chat { display: grid; gap: 8px; margin-top: 8px; }
.bubble { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--tint); }
.bubble.me { background: #fff; border: 1px solid var(--line); }
dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(560px, calc(100vw - 24px));
}
dialog.wide { width: min(760px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(26, 39, 68, 0.46); }
.sheet {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-pop);
  max-height: min(84dvh, 780px);
  overflow: auto;
}
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  z-index: 30;
  max-width: min(360px, calc(100vw - 32px));
}
.icon-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 40px;
  padding: 6px 10px;
  font-weight: 700;
  color: var(--navy);
}
.shell.collapsed { grid-template-columns: 76px 1fr; }
.shell.collapsed .brand-text,
.shell.collapsed .nav-label,
.shell.collapsed .nav button span,
.shell.collapsed .ws-kicker,
.shell.collapsed #ws-label,
.shell.collapsed .mono-card,
.shell.collapsed .user-meta { display: none; }
.shell.collapsed .collapse-chevron svg { transform: scaleX(-1); }
.shell.collapsed .userline { justify-content: center; padding-inline: 0; }
.text-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--navy);
  font-weight: 700;
  min-height: 32px;
  text-align: left;
}
.req p { grid-column: 1 / -1; margin: 0; font-weight: 700; color: var(--ink); }
fieldset { border: 0; margin: 0; padding: 0; }
.shell.collapsed .nav button { justify-content: center; padding-inline: 0; }
.shell.collapsed .ws { padding-inline: 8px; }
.shell.collapsed .ws-btn { font-size: 0; min-height: 36px; }
.req-grid { display: grid; gap: 8px; }
.req { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; background: var(--bg); border-radius: var(--radius-sm); }

@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .top { grid-template-columns: 1fr auto; }
  .search { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; }
  .login-brand h1 { max-width: none; }
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    z-index: 8;
    width: min(300px, 88vw);
    transform: translateX(-105%);
    transition: transform 160ms ease;
  }
  .shell.nav-open .side { transform: translateX(0); }
  .shell.nav-open .backdrop { display: block !important; position: fixed; inset: 0; background: rgba(26, 39, 68, 0.4); z-index: 7; border: 0; padding: 0; }
  .menu-btn, .side-close { display: inline-flex; align-items: center; }
  .shell.collapsed { grid-template-columns: 1fr; }
  .shell.collapsed .brand-text,
  .shell.collapsed .nav-label,
  .shell.collapsed .nav button span { display: inline; }
  .shell.collapsed .nav-label { display: block; }
  .shell.collapsed .user-meta,
  .shell.collapsed .mono-card { display: block; }
  .shell.collapsed .nav button { justify-content: flex-start; padding-inline: 10px; }
  .collapse-chevron { display: none; }
  .kv { grid-template-columns: 1fr; }
  main, .top { padding-left: 14px; padding-right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .side { transition: none; }
}
