:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 14px;
  color: #17283d;
  background: #f3f6fa;
  --ink: #17283d;
  --muted: #52647a;
  --subtle: #64758b;
  --line: #e0e8f0;
  --surface: #fff;
  --blue: #195cc5;
  --blue-hover: #144da6;
  --blue-soft: #eaf2ff;
  --teal: #087563;
  --teal-soft: #e6f6f0;
  --amber: #8a5208;
  --amber-soft: #fff3df;
  --danger: #ac283e;
  --danger-soft: #fce9ed;
  --sidebar: #0e2136;
  --shadow: 0 1px 2px #10294108, 0 3px 12px #10294106;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #398aff;
  outline-offset: 2px;
}
a { color: var(--blue); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 2.1vw, 31px); font-weight: 720; line-height: 1.23; letter-spacing: -.035em; }
h2 { font-size: 16px; font-weight: 700; line-height: 1.4; }
h3 { font-size: 14px; font-weight: 700; }
svg { display: inline-block; flex: none; vertical-align: middle; }

.brand { display: flex; align-items: center; gap: 11px; width: fit-content; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid #7bd2d97d;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(140deg, #269dbd, #2674bd 84%);
  box-shadow: 0 3px 12px #0a213951;
  font-size: 18px;
  font-weight: 750;
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-name { display: block; color: inherit; font-size: 16px; font-weight: 720; line-height: 1.25; letter-spacing: .01em; }
.brand small, .brand-name small, .brand-caption { display: block; margin-top: 3px; font-size: 11px; font-weight: 500; letter-spacing: .02em; }

.auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr); min-height: 100vh; }
.auth-story {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 52px;
  padding: clamp(36px, 6.6vw, 100px);
  overflow: hidden;
  color: #f5fbff;
  background: radial-gradient(ellipse at 12% 80%, #123c50 0, transparent 63%), linear-gradient(145deg, #10273e 0%, #0b2035 60%, #0a182b 100%);
}
.auth-story::before, .auth-story::after {
  position: absolute;
  z-index: -1;
  width: min(80vw, 670px);
  height: min(80vw, 670px);
  border: 1px solid #638ea849;
  border-radius: 42%;
  content: "";
  pointer-events: none;
  transform: rotate(30deg);
}
.auth-story::before { right: -36%; bottom: -56%; box-shadow: 0 0 0 34px #72a6b615, 0 0 0 76px #72a6b615; }
.auth-story::after { right: -48%; bottom: -28%; }
.auth-story h1 { max-width: 480px; font-size: clamp(32px, 4vw, 56px); line-height: 1.17; }
.auth-story p { max-width: 420px; color: #c4d6e5; line-height: 1.8; }
.auth-story h1 + p { margin-top: 16px; }
.auth-story .auth-kicker { margin-bottom: 10px; color: #91e1ea; font-size: 13px; font-weight: 700; letter-spacing: .14em; }
.auth-story .auth-caption { color: #a6bdd1; font-size: 12px; }
.auth-story .brand-caption, .auth-story .brand small { color: #b8cce1; }
.auth-form-wrap { display: grid; place-items: center; padding: 36px 28px; }
.auth-card {
  width: min(100%, 430px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 16px 45px #21395c0e;
}
.auth-card h1, .auth-card h2 { margin-bottom: 7px; font-size: 23px; }
.auth-card > .demo-badge { margin-bottom: 15px; }
.auth-card p { color: var(--muted); }
.auth-card .auth-kicker { margin-bottom: 5px; color: var(--blue); font-size: 12px; font-weight: 700; }
.auth-card .notice { margin-top: 14px; }
.auth-card form { display: grid; gap: 16px; margin-top: 24px; }
.auth-card .primary { width: 100%; margin-top: 2px; }
.auth-card .auth-form + .text-button { margin-top: 11px; }

.workspace { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  overflow-y: auto;
  padding: 23px 14px 16px;
  color: #edf6ff;
  background: radial-gradient(ellipse at 0 0, #1a354c 0, transparent 62%), var(--sidebar);
}
.sidebar .brand { margin: 0 9px; }
.sidebar .brand-caption, .sidebar .brand small { color: #afc2d7; }
.nav-list { display: grid; gap: 4px; min-width: 0; }
.nav-link {
  text-decoration: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 43px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #c5d4e3;
  background: transparent;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.nav-link:hover { color: #fff; background: #ffffff0d; }
.nav-link.is-active { border-color: #5073a353; color: #fff; background: #24486c; }
.nav-link.is-active::before { position: absolute; top: 10px; bottom: 10px; left: 0; width: 3px; border-radius: 0 3px 3px 0; background: #67d8e8; content: ""; }
.nav-symbol { display: grid; flex: none; place-items: center; width: 23px; height: 23px; border-radius: 6px; color: #b0c8dd; background: #ffffff13; font-size: 12px; }
.nav-symbol svg { width: 18px; height: 18px; }
.nav-link.is-active .nav-symbol { color: #a9edf5; background: #9ee8f024; }
.sidebar-bottom { margin-top: auto; padding: 14px 9px 2px; border-top: 1px solid #ffffff25; color: #b9c9da; font-size: 12px; }
.sidebar-bottom .button, .sidebar-bottom button { border-color: #ffffff29; color: #e7f2ff; background: #ffffff0d; }
.sidebar-bottom .button:hover, .sidebar-bottom button:hover { background: #ffffff1c; }
.sidebar-indicator { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #63d7bd; vertical-align: 2px; }

.workspace-main { min-width: 0; }
.topbar {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 9px clamp(18px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; }
.breadcrumb strong, .breadcrumb [aria-current] { color: var(--ink); font-weight: 650; }
.topbar-actions { display: flex; flex: none; align-items: center; gap: 11px; }
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid #bfe4db;
  border-radius: 999px;
  color: var(--teal);
  background: #edfaf5;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.demo-badge::before { width: 6px; height: 6px; border-radius: 50%; background: #119377; content: ""; }
.avatar, .person-avatar { display: grid; flex: none; place-items: center; border-radius: 50%; color: #214a7f; background: #e4effe; font-weight: 700; }
.avatar { width: 32px; height: 32px; font-size: 13px; }

.main-content { width: min(100%, 1510px); margin: 0 auto; padding: 29px clamp(18px, 3vw, 40px) 40px; }
#screen { display: grid; gap: 19px; min-width: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; padding: 1px 0 3px; }
.page-heading p { margin-top: 7px; color: var(--muted); }
.heading-actions, .member-actions, .form-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.heading-actions > *, .member-actions > * { white-space: nowrap; }
.flash { margin-bottom: 14px; padding: 11px 14px; border: 1px solid #c4e5d9; border-radius: 8px; color: var(--teal); background: var(--teal-soft); }
.flash:empty { display: none; }
.flash.error, .flash.danger { border-color: #f0c6d0; color: var(--danger); background: var(--danger-soft); }
.admin-identity { min-width: 0; max-width: 130px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 310px)); gap: 13px; }
.summary-card {
  position: relative;
  min-width: 0;
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.summary-label { display: block; padding-right: 35px; color: var(--muted); font-size: 13px; font-weight: 630; }
.summary-value { display: block; margin-top: 7px; color: #142d4a; font-size: clamp(21px, 2.35vw, 30px); font-weight: 730; line-height: 1.18; letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-note { display: block; margin-top: 7px; color: var(--subtle); font-size: 12px; }
.summary-symbol { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; color: #4c6177; background: #edf2f6; font-weight: 750; }
.summary-symbol svg { width: 17px; height: 17px; }
.summary-symbol.blue { color: var(--blue); background: var(--blue-soft); }
.summary-symbol.teal { color: var(--teal); background: var(--teal-soft); }
.summary-symbol.amber { color: var(--amber); background: var(--amber-soft); }
.summary-symbol.slate { color: #4c6177; background: #edf2f6; }

.panel { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 17px; }
.panel-header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.member-search {
  display: grid;
  grid-template-columns: minmax(0, 630px) max-content;
  align-items: end;
  gap: 11px 12px;
}
.member-search-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 12px; }
.member-search-fields input { font-weight: 400; }
.member-search-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.member-search-actions .button { min-height: 38px; min-width: 70px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 17px 14px; }
.panel-header .filters { flex: 0 1 680px; justify-content: flex-end; padding: 0; }
.search-field { display: flex; flex: 1 1 230px; align-items: center; gap: 7px; max-width: 360px; color: var(--muted); }
.filters > input.search-field { flex-basis: 180px; }
.search-field svg { width: 16px; height: 16px; }
.search-field input { width: 100%; }
.filters input, .filters select { min-height: 35px; }
.table-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #aab9ca transparent; }
table { width: 100%; border-spacing: 0; text-align: left; }
th, td { padding: 10px 13px; border-bottom: 1px solid #e8eef4; text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 17px; }
th:last-child, td:last-child { padding-right: 17px; }
th { border-top: 1px solid var(--line); border-bottom-color: var(--line); color: #455c73; background: #f4f7fb; font-size: 12px; font-weight: 720; white-space: nowrap; }
td { color: var(--ink); font-size: 13px; }
tbody tr:hover { background: #f6faff; }
tbody tr:last-child td { border-bottom: 0; }
tbody td .button, tbody td .text-button { white-space: nowrap; }
.person-cell { display: flex; align-items: center; gap: 9px; min-width: 114px; }
.person-avatar { width: 31px; height: 31px; font-size: 12px; }
.person-cell strong { font-weight: 680; }
.cell-note { display: block; margin-top: 2px; color: var(--subtle); font-size: 12px; }
.mono { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: .92em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; color: #4a5e73; background: #edf2f7; font-size: 12px; font-weight: 640; line-height: 1.3; white-space: nowrap; }
.status-pill::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-pill.active, .status-pill.settled { color: var(--teal); background: var(--teal-soft); }
.status-pill.eligible { color: var(--blue); background: var(--blue-soft); }
.status-pill.pending { color: var(--amber); background: var(--amber-soft); }
.status-pill.expired, .status-pill.none { color: #526279; background: #edf1f5; }
.status-pill.refunded { color: var(--danger); background: var(--danger-soft); }
.table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.empty-state { padding: 30px 17px; color: var(--muted); text-align: center; }

.button, .text-button, .modal-close { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: fit-content; border: 1px solid transparent; font-weight: 650; line-height: 1.3; text-decoration: none; }
.button { min-height: 36px; padding: 7px 12px; border-color: #ced9e5; border-radius: 7px; color: #243d56; background: var(--surface); }
.button:hover, .button.secondary:hover { border-color: #91a9c5; background: #f3f7fb; }
.button.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.button.primary:hover { border-color: var(--blue-hover); background: var(--blue-hover); }
.button.danger { border-color: #edc6d0; color: var(--danger); background: #fff7f8; }
.button.danger:hover { border-color: #dba2ae; background: var(--danger-soft); }
.text-button { min-height: 30px; padding: 3px 5px; border-radius: 5px; color: var(--blue); background: transparent; }
.text-button:hover { color: var(--blue-hover); background: var(--blue-soft); }
.text-button.person-cell { justify-content: flex-start; text-align: left; }
.text-button.danger { color: var(--danger); }
.text-button.danger:hover { background: var(--danger-soft); }

input, select, textarea {
  min-width: 0;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #ced9e5;
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
}
input:hover, select:hover, textarea:hover { border-color: #a4b6cc; }
input::placeholder, textarea::placeholder { color: #65758a; }
input[type="checkbox"], input[type="radio"] { width: 16px; min-height: auto; height: 16px; accent-color: var(--blue); }
textarea { min-height: 94px; resize: vertical; }
label { color: #2c4159; font-size: 13px; font-weight: 630; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field > input, .field > select, .field > textarea { width: 100%; }
.field > input[type="checkbox"], .field > input[type="radio"] { width: 16px; }
.form-grid, .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .wide, .field.full, .field.full-width, .field.span-2 { grid-column: 1 / -1; }
.panel > .form-grid, .panel > .detail-grid, .panel > form, .panel > .rules-list { padding: 0 17px 17px; }
.help, .inline-note { color: var(--muted); font-size: 12px; line-height: 1.55; }
.form-error { margin-top: 4px; color: var(--danger); font-size: 13px; }
.auth-card .form-error { color: var(--danger); }
.form-footer { justify-content: flex-end; margin-top: 16px; }
.demo-strip, .notice { padding: 11px 13px; border: 1px solid #cfe0f6; border-radius: 8px; color: #354f71; background: #f0f6fe; font-size: 13px; }
.demo-strip { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; }
.demo-strip .mono { margin-left: 8px; }
.notice.error, .notice.danger { border-color: #edc6d0; color: var(--danger); background: var(--danger-soft); }
.notice.warning { border-color: #efdbb7; color: var(--amber); background: var(--amber-soft); }
.page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.entitlement-modes { display: flex; flex-wrap: wrap; gap: 8px 16px; min-width: 0; margin: 0; padding: 0; border: 0; }
.entitlement-modes legend { margin-bottom: 7px; color: #2c4159; font-size: 13px; font-weight: 630; }
.entitlement-modes label { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; }
.entitlement-modes input { margin: 0; }
.entitlement-note { margin: 4px 0 12px; }
#entitlement-quota-note { margin-bottom: 0; }
.entitlement-code-body { display: grid; gap: 9px; padding: 0 17px 17px; }
.entitlement-code-body p, .entitlement-grades p { margin: 0; }
.entitlement-grades h3 { margin: 0 0 4px; color: var(--ink); font-size: 14px; }
.reset-row { display: flex; justify-content: flex-end; }
.rules-list { display: grid; gap: 7px; margin: 0; color: var(--muted); }
ul.rules-list, ol.rules-list { margin-left: 18px; }
.rules-list strong { color: var(--ink); }
.metric-row { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.metric-row:last-child { border-bottom: 0; }
.metric-row strong, .detail-value strong { color: var(--ink); font-weight: 680; }
.detail-grid { color: var(--muted); font-size: 13px; }
.detail-value { overflow-wrap: anywhere; }
.detail-value strong { display: block; margin-top: 3px; font-size: 14px; }
.member-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.member-head .person-avatar { width: 44px; height: 44px; font-size: 16px; }
.panel > .member-actions { padding: 0 17px 17px; }
.back-link { margin: -6px 0 -9px; }

.modal {
  width: min(100% - 24px, 540px);
  max-height: min(86vh, 760px);
  padding: 0;
  overflow: auto;
  border: 1px solid #d7e2ef;
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 22px 65px #07182747;
}
.modal::backdrop { background: #0b1c33a3; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.modal-body { display: grid; gap: 14px; padding: 16px 17px 18px; }
.modal-body > form { display: grid; gap: 13px; }
.modal-body > form .form-footer { margin-top: 2px; }
.modal-close { flex: none; width: 32px; height: 32px; border-color: #dce5ee; border-radius: 7px; color: var(--muted); background: var(--surface); font-size: 19px; }
.modal-close:hover { color: var(--ink); background: #eef4fa; }

@media (max-width: 780px) {
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; height: auto; overflow: visible; padding: 11px 13px 6px; }
  .sidebar .brand { margin: 0 2px; }
  .sidebar .brand-mark { width: 33px; height: 33px; border-radius: 9px; }
  .nav-list { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 2px 2px 4px; }
  .nav-link { justify-content: center; min-height: 39px; padding: 7px 9px; text-align: center; }
  .nav-link:focus-visible { outline-offset: -3px; }
  .nav-link.is-active::before { top: auto; right: 8px; bottom: 0; left: 8px; width: auto; height: 2px; border-radius: 2px 2px 0 0; }
  .nav-symbol { width: 19px; height: 19px; }
  .nav-symbol svg { width: 15px; height: 15px; }
  .sidebar-bottom { grid-column: 2; grid-row: 1; margin: 0; padding: 0 2px; border-top: 0; }
  .topbar { min-height: 50px; padding: 7px 15px; }
  .main-content { padding: 20px 15px 27px; }
  #screen { gap: 14px; }
  .page-grid { grid-template-columns: minmax(0, 1fr); }
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-story { min-height: 220px; gap: 20px; padding: 24px clamp(19px, 6vw, 42px); }
  .auth-story h1 { font-size: clamp(27px, 6vw, 37px); }
  .auth-story h1 + p { margin-top: 8px; }
  .auth-form-wrap { align-items: start; padding: 22px 15px 34px; }
  .auth-card { padding: 23px; }
}

@media (max-width: 630px) {
  .member-search { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .nav-list { gap: 2px; }
  .nav-link { padding-right: 3px; padding-left: 3px; font-size: clamp(12px, 3.3vw, 13px); }
  .nav-symbol { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .topbar-actions { gap: 7px; }
  .admin-identity { max-width: 76px; }
  .summary-grid { gap: 8px; }
  .summary-card { padding: 11px 10px; }
  .summary-label { padding-right: 22px; font-size: 12px; }
  .summary-symbol { top: 9px; right: 9px; width: 23px; height: 23px; border-radius: 6px; }
  .summary-symbol svg { width: 13px; height: 13px; }
  .summary-value { margin-top: 7px; }
  .summary-note { margin-top: 5px; }
  .panel-header, .table-footer { padding-right: 12px; padding-left: 12px; }
  .panel-header { flex-wrap: wrap; }
  .panel-header .filters { width: 100%; justify-content: flex-start; }
  .member-search-panel > .member-search { padding-right: 12px; padding-left: 12px; }
  .member-search-fields { grid-template-columns: minmax(0, 1fr); }
  .member-search-fields input { font-size: 16px; }
  .filters { padding: 0 12px 12px; }
  .search-field { max-width: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .entitlement-grades { grid-template-columns: minmax(0, 1fr); }
  .table-scroll table { min-width: 540px; }
  .demo-strip { align-items: flex-start; flex-direction: column; }
  .auth-card { padding: 19px; }
}

@media (max-width: 340px) {
  .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
