:root {
  --ink: #17243a;
  --muted: #66758a;
  --line: #dbe3ee;
  --soft: #f1f5fa;
  --paper: #fbfcff;
  --white: #ffffff;
  --accent: #2f6fb3;
  --accent-dark: #24598f;
  --accent-soft: #e8f1fb;
  --danger: #a8483d;
  --danger-soft: #faece9;
  --shadow: 0 24px 70px rgba(30, 61, 96, 0.1);
  font-family: 'DM Sans', 'Noto Sans TC', sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(178, 204, 232, 0.28), transparent 33rem),
    linear-gradient(180deg, #f5f9fd 0, var(--paper) 30rem);
}
body.modal-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.opening-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  color: white;
  background: #17243a;
  animation: opening-in 0.35s ease both;
}
.opening-content {
  width: min(90%, 560px);
  text-align: center;
  animation: opening-content-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
.opening-kicker {
  display: block;
  margin-bottom: 16px;
  color: #a9c9e8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.opening-content h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(38px, 6vw, 72px);
  letter-spacing: -0.06em;
  line-height: 1.1;
}
.opening-line {
  display: block;
  width: 0;
  height: 2px;
  margin: 24px auto 0;
  background: #76a8d6;
  animation: opening-line-in 0.75s ease 0.42s forwards;
}
.opening-screen.closing {
  animation: opening-out 0.48s ease both;
  pointer-events: none;
}

.topbar {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 1160px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(216, 225, 236, 0.86);
  background: rgba(251, 252, 255, 0.78);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
  animation: topbar-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand small {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
}
.brand-mark .bx {
  font-size: 20px;
}
.nav {
  display: flex;
  gap: 5px;
  padding: 4px;
  background: #edf2f8;
  border-radius: 11px;
}
.nav button {
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
}
.nav button.active {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 1px 4px rgba(29, 52, 82, 0.09);
}
.channel-switcher {
  display: flex;
  gap: 2px;
  padding: 2px;
  margin-right: 3px;
  border-right: 1px solid #d8e1ec;
}
.channel-switcher button {
  padding: 6px 10px;
  font-size: 12px;
}
.channel-switcher button.active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

.page {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: 68px 0 80px;
  animation: page-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both;
}
.form-layout {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 72px;
  align-items: start;
}
.intro {
  padding-top: 46px;
  position: sticky;
  top: 118px;
}
.intro > * {
  animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.intro > :nth-child(1) {
  animation-delay: 0.16s;
}
.intro > :nth-child(2) {
  animation-delay: 0.23s;
}
.intro > :nth-child(3) {
  animation-delay: 0.3s;
}
.intro > :nth-child(4) {
  animation-delay: 0.37s;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 12px;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  background: currentColor;
}
h1 {
  margin: 18px 0 16px;
  max-width: 470px;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.06;
  letter-spacing: -0.055em;
}
.lede {
  margin: 0;
  max-width: 430px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}
.application-notes {
  margin-top: 24px;
  max-width: 500px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.application-notes p {
  margin: 0;
}
.trust {
  margin-top: 38px;
  display: flex;
  gap: 22px;
  color: #7a8798;
  font-size: 13px;
}
.trust span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.trust .bx {
  color: var(--accent);
  font-size: 17px;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 225, 236, 0.96);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.login-page {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
  padding: 42px 20px;
}
.login-card {
  width: min(430px, 100%);
  padding: 34px;
}
.login-card h1 {
  margin: 0 0 9px;
  font-size: 29px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}
.login-card > p {
  margin: 0 0 25px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.login-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 20px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--ink);
}
.login-icon .bx {
  font-size: 23px;
}
.form-card {
  padding: 34px;
  animation: rise-in 0.72s cubic-bezier(0.22, 1, 0.36, 1) 0.17s both;
}
.form-heading {
  margin-bottom: 26px;
}
.form-heading h2 {
  margin: 0 0 7px;
  font-size: 23px;
  letter-spacing: -0.025em;
}
.form-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.dynamic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.dynamic-grid .full {
  grid-column: 1 / -1;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  margin-bottom: 19px;
}
.field label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}
.optional {
  color: #9aa29c;
  font-weight: 500;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #d7e0eb;
  border-radius: 11px;
  color: var(--ink);
  background: #fcfdff;
  padding: 12px 13px;
  outline: none;
  transition:
    border-color 0.16s,
    box-shadow 0.16s,
    background 0.16s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 111, 179, 0.12);
}
.field input[readonly] {
  color: var(--muted);
  background: #eef3f8;
  cursor: not-allowed;
}
.field textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.6;
}
.field fieldset,
fieldset.field {
  border: 0;
  padding: 0;
  min-width: 0;
}
.field legend {
  width: 100%;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 700;
}
.field legend small {
  color: #9aa29c;
  font-weight: 500;
}
.section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 30px 0 17px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
.section-label:first-of-type {
  margin-top: 4px;
}
.section-label span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
}
.radio-grid,
.company-grid {
  display: grid;
  gap: 8px;
}
.radio-grid {
  grid-template-columns: repeat(3, 1fr);
}
.company-grid {
  display: block;
  column-width: 150px;
  column-gap: 8px;
}
.company-grid .choice {
  display: block;
  width: 100%;
  break-inside: avoid;
  margin-bottom: 8px;
}
.choice {
  position: relative;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice span {
  display: block;
  padding: 10px 12px;
  border: 1px solid #d7e0eb;
  border-radius: 9px;
  background: #fcfdff;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  transition: 0.15s;
}
.choice input:checked + span {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
  font-weight: 700;
}
.choice input:focus-visible + span {
  outline: 3px solid rgba(47, 111, 179, 0.16);
}
.other-company {
  margin-top: 8px;
}
.security-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  margin: 3px 0 16px;
  border-radius: 10px;
  color: #2f5f91;
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.55;
}
.security-note .bx {
  min-width: 18px;
  margin-top: 1px;
  font-size: 18px;
}
.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 3px 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.consent input {
  accent-color: var(--accent);
  margin: 3px 0 0;
}
.primary,
.secondary,
.danger-btn,
.text-btn {
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}
.primary {
  width: 100%;
  padding: 13px 18px;
  color: white;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(47, 111, 179, 0.2);
  transition: 0.16s;
}
.primary.inline {
  width: auto;
  padding: 10px 17px;
}
.primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.secondary {
  padding: 9px 13px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
}
.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.icon-button .bx {
  font-size: 18px;
}
.danger-btn {
  padding: 9px 13px;
  color: var(--danger);
  background: var(--danger-soft);
}
.text-btn {
  padding: 5px 8px;
  color: var(--accent);
  background: transparent;
}

.notice {
  padding: 13px 15px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.5;
}
.notice.error {
  color: #81362f;
  background: var(--danger-soft);
}
.notice.info {
  color: #2f5f91;
  background: var(--accent-soft);
}
.success {
  min-height: 500px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: clamp(32px, 6vw, 50px);
}
.success-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}
.success-icon .bx {
  font-size: 32px;
}
.success h2 {
  margin: 0 0 8px;
  font-size: 25px;
}
.success-notes {
  display: grid;
  gap: 10px;
  max-width: 510px;
  margin: 20px auto 28px;
  text-align: left;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.success-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--soft);
}
.success-symbol {
  flex: 0 0 1em;
  color: var(--accent);
  font-weight: 700;
}
.success-note:nth-child(2) .success-symbol {
  color: #b77a28;
}
.success-note:nth-child(3) .success-symbol {
  color: #6d6f9d;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 26px;
}
.admin-header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-header .channel-switcher {
  align-items: center;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--soft);
}
.admin-header .channel-switcher span {
  padding: 0 6px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.admin-header .channel-switcher button {
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 13px;
}
.admin-header .channel-switcher button.active {
  color: var(--accent);
  background: var(--white);
  box-shadow: 0 1px 4px rgba(29, 52, 82, 0.09);
}
.admin-header,
.toolbar,
.table-card,
.pager,
.permissions-card,
.display-card,
.config-card,
.members-card {
  animation: rise-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toolbar {
  animation-delay: 0.08s;
}
.table-card {
  animation-delay: 0.14s;
}
.pager {
  animation-delay: 0.19s;
}
.permissions-card {
  animation-delay: 0.24s;
}
.display-card {
  animation-delay: 0.29s;
}
.config-card {
  animation-delay: 0.34s;
}
.members-card {
  animation-delay: 0.39s;
}
.admin-header h1 {
  margin: 0 0 8px;
  font-size: 38px;
}
.admin-header p {
  margin: 0;
  color: var(--muted);
}
.role-chip {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  color: #2f5f91;
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}
.role-chip > .bx {
  font-size: 16px;
}
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.search {
  flex: 1;
  position: relative;
}
.search .bx {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a948c;
  font-size: 19px;
}
.search input,
.toolbar select {
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  outline: none;
}
.search input {
  width: 100%;
  padding: 0 12px 0 40px;
}
.toolbar select {
  padding: 0 36px 0 12px;
}
.search input:focus,
.toolbar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 179, 0.1);
}

.table-card {
  overflow: hidden;
  box-shadow: 0 14px 44px rgba(30, 61, 96, 0.07);
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1050px;
}
th {
  padding: 13px 18px;
  text-align: left;
  color: #7b8798;
  background: #f5f8fc;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 16px 18px;
  border-bottom: 1px solid #e5ebf2;
  font-size: 14px;
  vertical-align: middle;
}
tbody tr {
  transition: background 0.15s;
}
tbody tr:hover {
  background: #fafcff;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.name-cell strong,
.subject-cell strong {
  display: block;
  font-weight: 700;
}
.name-cell small,
.subject-cell small {
  display: block;
  color: #8490a1;
  margin-top: 3px;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.display-cell strong {
  display: block;
  max-width: 220px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status.new {
  color: #916527;
  background: #fbf1df;
}
.status.processing {
  color: #37658a;
  background: #e8f1f7;
}
.status.done {
  color: #357153;
  background: #e7f2ea;
}
.row-action {
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  font-weight: 600;
}
.row-action:hover {
  background: var(--soft);
  color: var(--ink);
}
.empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.pager-actions {
  display: flex;
  gap: 8px;
}
.page-numbers {
  display: flex;
  align-items: center;
  gap: 5px;
}
.page-ellipsis {
  min-width: 22px;
  text-align: center;
  color: #9aa29c;
}
.pager button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 9px;
  padding: 7px 12px;
  color: var(--ink);
}
.pager button.active {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
}
.pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 31, 49, 0.48);
  backdrop-filter: blur(5px);
}
.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 28px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
}
.small-modal {
  width: min(500px, 100%);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.modal-head h2 {
  margin: 0 0 5px;
  font-size: 23px;
}
.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: var(--soft);
  color: var(--muted);
  font-size: 21px;
}
.close .bx {
  display: block;
  font-size: 24px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.detail {
  min-width: 0;
}
.detail.full {
  grid-column: 1 / -1;
}
.detail label {
  display: block;
  margin-bottom: 6px;
  color: #8490a1;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
.detail p {
  margin: 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.message-box {
  padding: 14px;
  background: var(--soft);
  border-radius: 10px;
  white-space: pre-wrap;
}
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.edit-grid .full {
  grid-column: 1 / -1;
}
.edit-grid .field textarea {
  min-height: 100px;
}
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
}
.modal-actions .right {
  display: flex;
  gap: 9px;
}
.modal-actions select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 30px 8px 10px;
  background: white;
}

.members-card {
  padding: 24px;
  margin-top: 18px;
  box-shadow: 0 14px 44px rgba(30, 61, 96, 0.07);
}
.config-card {
  padding: 24px;
  margin-top: 30px;
  box-shadow: 0 14px 44px rgba(30, 61, 96, 0.07);
}
.display-card {
  padding: 24px;
  margin-top: 30px;
  box-shadow: 0 14px 44px rgba(30, 61, 96, 0.07);
}
.permissions-card {
  padding: 24px;
  margin-top: 30px;
  box-shadow: 0 14px 44px rgba(30, 61, 96, 0.07);
}
.settings-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.settings-badge .bx {
  font-size: 15px;
}
.permission-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.permission-table-head,
.permission-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 76px;
  align-items: center;
}
.permission-table-head {
  padding: 10px 14px;
  color: #8490a1;
  background: #f5f8fc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
}
.permission-table-head span:first-child {
  text-align: left;
}
.permission-row {
  min-height: 66px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.permission-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.permission-icon {
  display: grid;
  flex: 0 0 32px;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--accent);
  background: var(--accent-soft);
}
.permission-icon .bx {
  font-size: 18px;
}
.permission-name strong,
.permission-name small {
  display: block;
}
.permission-name strong {
  font-size: 14px;
}
.permission-name small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.permission-toggle {
  display: grid;
  place-items: center;
  cursor: pointer;
}
.permission-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle-ui {
  position: relative;
  display: block;
  width: 38px;
  height: 23px;
  border-radius: 999px;
  background: #d9e2ed;
  transition: 0.16s;
}
.toggle-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(23, 36, 58, 0.18);
  transition: 0.16s;
}
.permission-toggle input:checked + .toggle-ui {
  background: var(--accent);
}
.permission-toggle input:checked + .toggle-ui::after {
  transform: translateX(15px);
}
.permission-toggle input:focus-visible + .toggle-ui {
  outline: 3px solid rgba(47, 111, 179, 0.18);
  outline-offset: 2px;
}
.permission-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}
.permission-footer .secondary {
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.display-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}
.display-form .field {
  margin: 0;
}
.display-form .secondary {
  height: 43px;
}
.members-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.members-head h2 {
  margin: 0 0 4px;
  font-size: 19px;
}
.members-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.member-form {
  display: flex;
  gap: 8px;
}
.member-form input,
.member-form select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  background: white;
}
.access-form {
  display: grid;
  grid-template-columns: 1fr 1fr 130px 1.35fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 12px;
  background: var(--soft);
}
.access-form .field {
  margin: 0;
}
.access-form .secondary {
  height: 43px;
}
.scope-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  max-width: 520px;
}
.scope-form .field {
  margin: 0;
}
.scope-form .secondary {
  height: 43px;
}
.scope-hint {
  margin: 9px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.member-list {
  display: grid;
  gap: 8px;
}
.question-list {
  display: grid;
  gap: 9px;
}
.question-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.question-item.inactive {
  opacity: 0.58;
  background: var(--soft);
}
.question-item strong {
  display: block;
  font-size: 14px;
}
.question-meta {
  display: flex;
  gap: 6px;
  margin-top: 5px;
}
.question-meta span {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--soft);
  font-size: 11px;
}
.question-meta .scope-tag {
  color: #2f5f91;
  background: var(--accent-soft);
}
.question-actions {
  display: flex;
  gap: 3px;
}
.field-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.order-controls {
  display: flex;
  gap: 4px;
  padding-right: 10px;
  border-right: 1px solid var(--line);
}
.order-controls button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  font-weight: 700;
}
.order-controls .bx {
  display: block;
  font-size: 19px;
}
.order-controls button:hover:not(:disabled) {
  color: var(--accent);
  border-color: #b8cde2;
  background: var(--accent-soft);
}
.order-controls button:disabled {
  opacity: 0.3;
  cursor: default;
}
.danger-text {
  color: var(--danger);
}
.empty.compact {
  padding: 30px 20px;
}
.setting-row {
  display: flex;
  gap: 24px;
  padding: 4px 0 24px;
  color: var(--muted);
  font-size: 14px;
}
.setting-row input {
  accent-color: var(--accent);
}
.hidden {
  display: none;
}
.member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.member strong {
  font-size: 14px;
}
.member span {
  color: var(--muted);
  font-size: 12px;
}
.loading {
  min-height: 420px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.spinner {
  width: 25px;
  height: 25px;
  border: 3px solid #dce5f0;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes topbar-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes opening-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes opening-content-in {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes opening-line-in {
  from {
    width: 0;
  }
  to {
    width: 74px;
  }
}
@keyframes opening-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 800px) {
  .topbar {
    padding: 0 18px;
    height: 64px;
  }
  .page {
    width: min(100% - 28px, 620px);
    padding: 36px 0 60px;
  }
  .form-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .intro {
    padding-top: 0;
    position: static;
  }
  h1 {
    font-size: 42px;
  }
  .trust {
    margin-top: 24px;
  }
  .form-card {
    padding: 24px;
  }
  .admin-header {
    align-items: flex-start;
    gap: 14px;
  }
  .admin-header-tools {
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
  }
  .admin-header h1 {
    font-size: 31px;
  }
  .toolbar {
    flex-direction: column;
  }
  .pager {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .pager-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .field-row,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .dynamic-grid {
    grid-template-columns: 1fr;
  }
  .dynamic-grid .full {
    grid-column: auto;
  }
  .edit-grid {
    grid-template-columns: 1fr;
  }
  .edit-grid .full {
    grid-column: auto;
  }
  .radio-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .detail.full {
    grid-column: auto;
  }
  .members-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .access-form {
    grid-template-columns: 1fr 1fr;
  }
  .access-form .units-field {
    grid-column: 1 / -1;
  }
  .access-form > .secondary {
    grid-column: 1 / -1;
  }
  .scope-form {
    max-width: none;
  }
  .display-form {
    grid-template-columns: 1fr 1fr;
  }
  .permission-table-head,
  .permission-row {
    grid-template-columns: minmax(0, 1fr) 64px 64px;
  }
  .question-item {
    align-items: flex-start;
  }
  .field-actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
  }
  .order-controls {
    padding: 0 0 5px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .member-form {
    width: 100%;
    flex-wrap: wrap;
  }
  .member-form input {
    flex: 1;
    min-width: 160px;
  }
  .topbar {
    align-items: flex-start;
    height: auto;
    min-height: 64px;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px;
  }
  .nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .channel-switcher {
    border-right: 0;
    margin-right: 0;
  }
}

@media (max-width: 480px) {
  .brand span:last-child {
    display: none;
  }
  .brand small {
    display: none;
  }
  .nav button {
    padding: 7px 10px;
  }
  .field-row {
    display: block;
  }
  .form-card {
    padding: 21px 18px;
    border-radius: 16px;
  }
  .trust {
    display: grid;
    gap: 8px;
  }
  .modal {
    padding: 21px;
  }
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .modal-actions .right {
    justify-content: space-between;
  }
  .access-form {
    grid-template-columns: 1fr;
  }
  .access-form .units-field {
    grid-column: auto;
  }
  .access-form > .secondary {
    grid-column: auto;
  }
  .login-page {
    min-height: calc(100vh - 64px);
    padding: 24px 14px;
  }
  .login-card {
    padding: 26px 21px;
    border-radius: 16px;
  }
  .scope-form {
    grid-template-columns: 1fr;
  }
  .display-form {
    grid-template-columns: 1fr;
  }
  .permission-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .permission-footer .secondary {
    width: 100%;
  }
  .admin-header {
    flex-direction: column;
  }
  .admin-header-tools {
    width: 100%;
    align-items: stretch;
  }
  .admin-header .channel-switcher {
    justify-content: center;
  }
}
