:root {
  color-scheme: light;
  --canvas: #f4f6fb;
  --surface: #fff;
  --ink: #182743;
  --muted: #52627b;
  --border: #dce4f0;
  --blue: #2857c5;
  --blue-dark: #1a429e;
  --blue-soft: #ebf1ff;
  --navy: #172642;
  --green: #146849;
  --green-soft: #e5f5ed;
  --amber: #85501c;
  --amber-soft: #fff3df;
  --red: #9f2239;
  --red-soft: #ffedf1;
  --radius: 15px;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.3rem); letter-spacing: -.025em; line-height: 1.2; }
h2 { font-size: 1.26rem; line-height: 1.35; }
h3 { font-size: 1.02rem; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-weight: 680;
  white-space: nowrap;
  cursor: pointer;
}
button:hover { background: var(--blue-dark); }
button.secondary { color: var(--ink); background: var(--surface); border-color: #cad6e7; }
button.secondary:hover { background: var(--blue-soft); border-color: #acbfea; }
button.danger { color: var(--red); background: var(--red-soft); border-color: #f3c8d2; }
button.danger:hover { background: #ffdde6; }
button.compact { min-height: 34px; padding: 5px 11px; font-size: .88rem; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid #3475d8; outline-offset: 3px; }
.masthead {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 13px;
  min-height: 69px;
  padding: 10px clamp(15px, 3vw, 36px);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; }
.brand small { font-size: .77rem; color: var(--muted); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #294fbc, #5982e3);
  font-size: 1.28rem;
  font-weight: 750;
}
.actions, .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.operator { color: var(--muted); overflow-wrap: anywhere; font-size: .84rem; }
.operator::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-inline-end: 6px;
  border-radius: 50%;
  background: #1c8867;
  content: "";
}
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: stretch;
  width: min(1010px, calc(100% - 44px));
  margin: clamp(28px, 9vh, 94px) auto;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 22px 65px #142b5d14;
  overflow: hidden;
}
.login-intro {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 20px;
  min-width: 0;
  padding: clamp(30px, 5vw, 70px);
  color: #fff;
  background:
    radial-gradient(ellipse at 100% 0, #3e67d5 0, transparent 60%),
    linear-gradient(145deg, #1c326b, #132241);
}
.login-intro h1 { font-size: clamp(2.05rem, 5.2vw, 4rem); }
.login-intro .eyebrow { color: #c7d7ff; }
.login-intro p { color: #dce7ff; max-width: 25ch; font-size: 1.04rem; }
.intro-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.intro-tags span { border: 1px solid #afc5fb78; border-radius: 22px; padding: 4px 10px; color: #e8efff; font-size: .78rem; }
#login-form { padding: clamp(24px, 4.5vw, 48px); border: 0; }
#login-form h2 { margin-bottom: 6px; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: .78rem; font-weight: 760; letter-spacing: .08em; overflow-wrap: anywhere; }
.caption { color: var(--muted); font-size: .85rem; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.form { display: grid; gap: 14px; padding: 23px; }
label { display: grid; gap: 5px; min-width: 0; font-weight: 650; font-size: .9rem; }
label small { color: var(--muted); font-weight: 400; }
input:not([type="checkbox"]), select, textarea {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #c9d5e7;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
}
textarea { resize: vertical; }
.console-layout { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: calc(100dvh - 69px); }
.rail { display: flex; flex-direction: column; min-width: 0; background: var(--navy); color: #dce7ff; padding: 23px 13px; }
.rail-label, .rail-footer { padding-inline: 11px; font-size: .77rem; letter-spacing: .04em; color: #adbedf; }
.rail-nav { display: grid; gap: 6px; margin-top: 9px; }
.rail-nav button { width: 100%; justify-content: flex-start; gap: 8px; text-align: left; background: transparent; color: #dce7ff; }
.rail-nav button:hover { background: #233860; }
.rail-nav button[aria-pressed="true"] { color: #fff; background: #304b87; border-color: #4a67a6; }
.nav-icon { font-size: 1.08rem; }
.rail-footer { margin-top: auto; padding-top: 22px; }
.console-main { width: min(1530px, 100%); margin-inline: auto; min-width: 0; padding: clamp(18px, 3.2vw, 44px); }
.page-heading, .directory-toolbar, .directory-footer, .dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 13px; }
.page-heading { margin-bottom: 22px; }
.page-heading .caption { margin-top: 6px; }
.overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 22px; }
.metric { display: grid; gap: 5px; padding: 15px; border-top: 3px solid #557cdb; }
.metric:nth-child(2) { border-top-color: #219677; }
.metric:nth-child(3) { border-top-color: #745fca; }
.metric:nth-child(4) { border-top-color: #8594b3; }
.metric span, .metric small { color: var(--muted); }
.metric span { font-size: .85rem; font-weight: 650; }
.metric strong { font-size: clamp(1.45rem, 3.2vw, 2.15rem); line-height: 1.18; font-variant-numeric: tabular-nums; }
.directory { overflow: hidden; }
.directory-toolbar, .directory-footer { padding: 16px; }
.directory-toolbar .caption { margin-top: 4px; }
.filters > .search-field { width: min(250px, 100%); }
table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); background: #edf2fa; font-size: .83rem; }
th:first-child { width: 25%; }
th:nth-child(4) { width: 19%; }
th:last-child { width: 14%; }
td { overflow-wrap: anywhere; }
td:first-child, th:first-child { padding-left: 16px; }
td:last-child, th:last-child { padding-right: 16px; }
td small { display: block; color: var(--muted); }
td:first-child strong { display: block; }
tbody tr:hover { background: #f8faff; }
.empty { color: var(--muted); text-align: center; padding: 34px 15px; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 20px; color: #465772; background: #edf1f7; white-space: nowrap; font-size: .8rem; font-weight: 680; }
.badge.good { color: var(--green); background: var(--green-soft); }
.badge.warn { color: var(--amber); background: var(--amber-soft); }
.badge.inactive { color: var(--red); background: var(--red-soft); }
.message { border-radius: 8px; padding: 9px 12px; color: var(--green); background: var(--green-soft); overflow-wrap: anywhere; }
.message.error { color: var(--red); background: var(--red-soft); }
#workspace-status { margin-bottom: 14px; }
dialog {
  width: min(590px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 65px #17243a39;
}
dialog::backdrop { background: #1424418c; }
.side-sheet {
  inset: 0 0 0 auto;
  width: min(650px, 100%);
  height: 100%;
  max-height: 100dvh;
  margin: 0;
  border-radius: 15px 0 0 15px;
}
.dialog-heading { align-items: flex-start; }
.dialog-heading h2, .dialog-heading h3 { overflow-wrap: anywhere; }
.dialog-actions { justify-content: flex-end; }
.dialog-actions.spread { justify-content: space-between; }
.detail-nav { display: flex; gap: 7px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.detail-nav button[aria-pressed="true"] { background: var(--blue-soft); border-color: #a9bee9; color: var(--blue-dark); }
.detail-stack, .form-fields { display: grid; gap: 13px; min-width: 0; }
.form-fields { border: 0; padding: 0; }
.fields, .plan-options, dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
fieldset { min-width: 0; margin: 0; border: 1px solid var(--border); border-radius: 9px; }
fieldset:disabled { opacity: .65; }
legend { padding: 0 4px; font-weight: 650; }
.plan-options label { display: flex; align-items: flex-start; gap: 6px; border-radius: 6px; padding: 6px; background: #f2f5fb; }
.plan-options input { accent-color: var(--blue); }
.plan-options small { display: block; }
.usage { border-radius: 10px; padding: 12px; background: #edf2fa; }
.usage h3 { margin-bottom: 5px; }
dt { color: var(--muted); font-size: .8rem; }
dd { font-weight: 700; overflow-wrap: anywhere; }
.member-rows { display: grid; gap: 7px; }
.member-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 9px; align-items: center; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; }
.member-row strong, .member-row small { display: block; overflow-wrap: anywhere; }
.member-row small { color: var(--muted); }
@media (max-width: 1150px) {
  .console-layout { grid-template-columns: 174px minmax(0, 1fr); }
  .console-main { padding: 20px; }
}
@media (max-width: 930px) {
  .console-layout { grid-template-columns: minmax(0, 1fr); }
  .rail { padding: 9px 12px; }
  .rail-label, .rail-footer { display: none; }
  .rail-nav { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; }
  .rail-nav button { width: auto; min-height: 36px; padding: 6px 9px; font-size: .85rem; }
}
@media (max-width: 760px) {
  .masthead { position: static; }
  .operator { display: none; }
  .login-shell { grid-template-columns: minmax(0, 1fr); width: calc(100% - 24px); }
  .login-intro { padding: 22px; gap: 11px; }
  .console-main { padding: 14px 12px 24px; }
  .page-heading, .directory-toolbar, .directory-footer { flex-wrap: wrap; }
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 10px; }
  .directory-toolbar, .directory-footer { padding: 12px; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5px 10px; padding: 10px 12px; border-top: 1px solid var(--border); }
  tbody td { display: block; padding: 0 !important; border: 0; font-size: .88rem; }
  tbody td:first-child, tbody td.empty { grid-column: 1 / -1; }
  tbody td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .77rem; }
  tbody td:last-child { text-align: right; }
  tbody td.empty { padding: 15px !important; text-align: center; }
  .side-sheet { border-radius: 0; }
}
@media (max-width: 400px) {
  .form { padding: 14px; }
  .fields, .plan-options { grid-template-columns: 1fr; }
  .rail-nav button { gap: 4px; }
  .nav-icon { display: none; }
  .member-row { grid-template-columns: minmax(0, 1fr) auto; }
  .member-row button { grid-column: 1 / -1; justify-self: end; }
}
