:root {
  color-scheme: light;
  --canvas: #f4f5f8;
  --surface: #fff;
  --surface-subtle: #fbfcfe;
  --ink: #14161d;
  --muted: #4a5162;
  --border: #e9ebf0;
  --control-border: #dde1ea;
  --brand: #e60023;
  --brand-deep: #a8001a;
  --brand-soft: #fff1f2;
  --brand-line: #ffd2d7;
  --brand-gradient: linear-gradient(118deg, #e60023 0%, #ff4d3d 58%, #ff8a3d 100%);
  --button-gradient: linear-gradient(118deg, #b1001d 0%, #c82a28 58%, #a94513 100%);
  --button-shadow: 0 6px 18px -9px #e6002377;
  --panel-shadow: 0 2px 6px #14161d08, 0 10px 26px -14px #14161d29;
  --green: #146849;
  --green-soft: #e7f8f0;
  --amber: #85501c;
  --amber-soft: #fef4e6;
  --radius: 18px;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", Roboto, Arial, 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(--button-gradient);
  box-shadow: var(--button-shadow);
  color: #fff;
  font-weight: 680;
  white-space: nowrap;
  cursor: pointer;
}
button:hover { background: var(--brand-deep); }
button.secondary { color: var(--ink); background: var(--surface); border-color: var(--control-border); box-shadow: none; }
button.secondary:hover { color: var(--brand-deep); background: var(--brand-soft); border-color: var(--brand); }
button.danger { color: var(--brand-deep); background: var(--brand-soft); border-color: var(--brand-line); box-shadow: none; }
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 var(--brand-deep); 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; font-weight: 800; letter-spacing: .02em; }
.brand small { font-size: .73rem; color: var(--muted); }
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  overflow: hidden;
  color: #fff;
  background: var(--button-gradient);
  box-shadow: 0 2px 10px #e6002340;
  font-size: 1.28rem;
  font-weight: 750;
}
.brand-mark::after {
  position: absolute;
  inset: 0;
  background: url("/assets/logo.jpg") center / cover no-repeat;
  content: "";
}
.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 #14161d16;
  overflow: hidden;
}
.login-intro {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 20px;
  min-width: 0;
  padding: clamp(30px, 5vw, 70px);
  color: var(--ink);
  border-inline-end: 1px solid var(--brand-line);
  background:
    radial-gradient(ellipse at 100% 0, #ffd2d799 0, transparent 65%),
    radial-gradient(ellipse at 0 100%, #ff8a3d26 0, transparent 57%),
    linear-gradient(180deg, #fff 0%, #fff7f8 100%);
}
.login-intro h1 { font-size: clamp(2.05rem, 5vw, 3.55rem); }
.login-intro h1 span { color: var(--brand-deep); }
.login-intro .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  background: var(--surface);
}
.login-intro .eyebrow::before { width: 14px; height: 2px; border-radius: 2px; background: var(--brand-gradient); content: ""; }
.login-intro p { color: var(--muted); max-width: 27ch; font-size: 1.04rem; }
.intro-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.intro-tags span { border-radius: 999px; padding: 4px 10px; background: var(--brand-soft); color: var(--brand-deep); font-size: .78rem; font-weight: 650; }
#login-form { padding: clamp(24px, 4.5vw, 48px); border: 0; }
#login-form h2 { margin-bottom: 6px; }
.eyebrow { margin: 0 0 4px; color: var(--brand-deep); 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 var(--control-border);
  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(--surface); border-inline-end: 1px solid var(--border); padding: 23px 13px; }
.rail-label, .rail-footer { padding-inline: 11px; font-size: .77rem; letter-spacing: .04em; color: var(--muted); }
.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: var(--muted); box-shadow: none; }
.rail-nav button:hover { background: var(--brand-soft); color: var(--brand-deep); }
.rail-nav button[aria-pressed="true"] { color: var(--brand-deep); background: var(--brand-soft); border-color: var(--brand-line); }
.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 var(--brand); box-shadow: var(--panel-shadow); }
.metric:nth-child(2) { border-top-color: #12b76a; }
.metric:nth-child(3) { border-top-color: #ff8a3d; }
.metric:nth-child(4) { border-top-color: #878e9e; }
.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; box-shadow: var(--panel-shadow); }
.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: #edeff4; 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: var(--surface-subtle); }
.empty { color: var(--muted); text-align: center; padding: 34px 15px; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 20px; color: var(--muted); background: #edeff4; 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(--brand-deep); background: var(--brand-soft); }
.message { border-radius: 8px; padding: 9px 12px; color: var(--green); background: var(--green-soft); overflow-wrap: anywhere; }
.message.error { color: var(--brand-deep); background: var(--brand-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 #14161d39;
}
dialog::backdrop { background: #14161d75; }
.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(--brand-soft); border-color: var(--brand-line); color: var(--brand-deep); }
.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: var(--canvas); }
.plan-options input { accent-color: var(--brand-deep); }
.plan-options small { display: block; }
.usage { border-radius: 10px; padding: 12px; background: var(--canvas); }
.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; border-inline-end: 0; border-block-end: 1px solid var(--border); }
  .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; border-inline-end: 0; border-block-end: 1px solid var(--brand-line); }
  .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; }
}
