:root {
  font-family: Inter, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #142341;
  background: #f2f5fb;
  line-height: 1.5;
  --line: #d5deec;
  --accent: #1247c4;
  --muted: #52627c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header {
  min-height: 69px; padding: 0 max(24px, calc((100vw - 1408px) / 2));
  background: #15233f; color: #fff;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.brand { display: flex; gap: 22px; align-items: center; color: inherit; font-size: 24px; font-weight: 750; text-decoration: none; }
.brand-mark {
  width: 27px; height: 29px; background: currentColor;
  clip-path: polygon(48% 0, 91% 22%, 71% 36%, 48% 24%, 21% 40%, 21% 64%, 48% 80%, 72% 65%, 91% 79%, 48% 100%, 0 73%, 0 27%);
}
.brand > span:last-child, .identity button { border-left: 1px solid #637089; padding-left: 23px; }
.identity, .actions, .toolbar, .filters, .pagination { display: flex; gap: 12px; align-items: center; }
.identity { gap: 22px; font-size: 17px; }
.identity button { color: inherit; background: transparent; border-color: #637089; border-width: 0 0 0 1px; border-radius: 0; padding: 0 0 0 23px; }
.identity button:hover { background: transparent; text-decoration: underline; }
main { width: min(100% - 48px, 1408px); margin: 42px auto; }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: clamp(32px, 3.4vw, 48px); line-height: 1.12; }
h2 { font-size: 23px; }
h3 { font-size: 22px; }
.toolbar { justify-content: space-between; }
.toolbar h1, .toolbar h2 { margin: 0; }
.page-heading { padding-bottom: 25px; margin-bottom: 29px; border-bottom: 1px solid #c7d2e5; }
.page-heading .actions button { min-height: 50px; padding-inline: 24px; font-size: 18px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); gap: 20px; }
.panel, dialog { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 25px; min-width: 0; }
.signin { max-width: 450px; margin: 8vh auto 0; padding: 28px; }
.signin h1 { font-size: 28px; margin-bottom: 20px; }
form, label { display: grid; gap: 10px; }
label, .password-field { font-weight: 650; }
button, input, select {
  font: inherit; min-height: 44px; min-width: 0; padding: 8px 14px;
  border: 1px solid #cbd6e7; border-radius: 9px; background: #fff; color: inherit;
}
input::placeholder { color: var(--muted); }
button { cursor: pointer; white-space: nowrap; font-weight: 650; }
button:hover { background: #edf3fd; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid #3165ba; outline-offset: 2px; }
.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.primary:hover { background: #103ba2; }
a, .link-button { color: var(--accent); }
.link-button { min-height: 0; border: 0; padding: 0; background: transparent; white-space: normal; text-align: left; }
.link-button:hover { background: transparent; text-decoration: underline; }
.filters { margin-bottom: 26px; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field::before, .search-field::after { content: ""; position: absolute; pointer-events: none; }
.search-field::before { left: 16px; top: 14px; width: 12px; height: 12px; border: 2px solid var(--muted); border-radius: 50%; }
.search-field::after { left: 28px; top: 28px; width: 8px; height: 2px; background: var(--muted); transform: rotate(45deg); }
.search-field input { width: 100%; padding-left: 42px; }
.filters input, .filters select, .filters button { min-height: 49px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--line); }
th { background: #edf2fb; white-space: nowrap; font-weight: 750; }
th:first-child { width: 42%; border-top-left-radius: 5px; }
th:last-child { border-top-right-radius: 5px; }
td:first-child { border-left: 3px solid transparent; padding-left: 15px; }
td .link-button { color: inherit; font-size: 19px; font-weight: 750; }
td small { display: block; color: var(--muted); font-size: 15px; }
.selected td { background: #e9f0ff; }
.selected td:first-child { border-left-color: var(--accent); }
.badge, .code-pill { display: inline-flex; gap: 8px; align-items: center; padding: 3px 11px; border-radius: 7px; white-space: nowrap; }
.badge { color: #135d2b; background: #e7f7e9; }
.badge.disabled, .code-pill { color: #465570; background: #eaf0f7; }
.badge::before, .pending-status::before, #audit summary::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.pending-status { display: inline-flex; gap: 9px; align-items: center; color: #a95b00; }
.detail { font-size: 17px; }
.detail h2 { font-size: clamp(25px, 2.6vw, 37px); line-height: 1.2; overflow-wrap: anywhere; }
.detail-meta, .detail-links { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.detail-links { gap: 18px; }
.detail-links button { border-left: 1px solid var(--line); padding-left: 18px; }
.detail-heading, .detail-section { padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.detail-section, .detail-footer { padding-top: 22px; }
.detail-footer .danger { color: #b31922; }
.admin-pending {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 23px; border: 1px solid #ffedcf; border-radius: 9px; background: #fff4df; padding: 12px 14px;
  color: #38230f; font-weight: 750;
}
.admin-pending > span { display: inline-flex; align-items: center; gap: 9px; }
.warning-icon { display: grid; place-items: center; color: #ac5c00; border: 2px solid #ef920b; border-radius: 50%; width: 24px; height: 24px; }
.muted { color: var(--muted); }
.pagination { justify-content: end; margin-top: 14px; }
.items { padding: 0; margin: 0; list-style: none; }
.items li { padding: 6px 3px; overflow-wrap: anywhere; }
.brand-row { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.items summary { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.items summary::-webkit-details-marker { display: none; }
#audit summary::before { background: #8290a8; }
#audit time { margin-left: auto; text-align: right; font-size: .9em; }
.items details p { font-size: 13px; color: var(--muted); margin: 5px 0 5px 18px; }
#notice, .form-error { padding: 9px 12px; background: #eaf3ff; border-radius: 7px; }
#notice.error, .form-error { background: #fff0f0; color: #922333; }
dialog { width: min(450px, calc(100% - 32px)); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: #14284f77; }
#tenant-dialog { width: min(955px, calc(100% - 40px)); padding: 0; box-shadow: 0 22px 60px #16294e33; }
#tenant-form { gap: 0; }
.dialog-body { padding: 30px 40px 34px; }
.dialog-heading { margin-bottom: 8px; }
.dialog-heading h2 { font-size: clamp(27px, 3vw, 39px); }
.close-button { min-height: 36px; padding: 0 8px; border: 0; font-size: 25px; line-height: 1; }
.form-section { min-width: 0; margin: 0 0 17px; padding: 13px 0 19px; border: 0; border-bottom: 1px solid var(--line); }
.form-section:last-child { margin: 0; padding-bottom: 0; border: 0; }
.form-section legend { display: flex; align-items: center; gap: 12px; padding: 0; font-size: 22px; font-weight: 750; }
.form-section legend::before { content: ""; width: 5px; height: 22px; border-radius: 3px; background: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 35px; align-items: start; }
.form-grid label, .password-field { gap: 6px; }
.form-grid small { font-weight: 400; }
.password-control { position: relative; margin-top: 6px; }
.password-control input { width: 100%; padding-right: 48px; }
.icon-button { position: absolute; inset: 2px 3px 2px auto; min-height: 0; width: 40px; border: 0; padding: 0; color: var(--muted); }
.icon-button::before { content: ""; display: block; width: 16px; height: 10px; border: 2px solid currentColor; border-radius: 75% 20%; transform: rotate(45deg); margin: auto; }
.icon-button::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: currentColor; inset: 0; margin: auto; }
.icon-button[aria-pressed="true"] { color: var(--accent); background: #edf3fd; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 14px; border-top: 1px solid var(--line); padding: 18px 34px; }
.dialog-footer button { min-width: 102px; }
.dialog-footer .primary { min-width: 142px; }
@media (max-width: 950px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  header { min-height: 60px; padding: 0 15px; }
  .brand { font-size: 18px; gap: 10px; }
  .brand-mark { width: 20px; height: 21px; }
  .brand > span:last-child, .identity button { padding-left: 10px; }
  .identity { font-size: 13px; gap: 10px; }
  main { width: calc(100% - 28px); margin-top: 22px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .actions button { padding-inline: 14px; min-height: 42px; font-size: 15px; }
  .panel, .dialog-body { padding: 17px; }
  .filters { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  th, td { padding-inline: 9px; font-size: 14px; }
  td:first-child { padding-left: 6px; }
  td .link-button { font-size: 15px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .dialog-footer { padding: 13px 17px; }
}
