/* Compact, centered credits cards with equal columns. */
.credits-summary-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 18px;
  align-items: stretch;
}
.credits-summary-layout > .settingsgrid,
.credits-analytics {
  display: contents;
}
.credits-analytics > .credit-trend {
  grid-column: 1/-1;
}
.credits-summary-layout .balance,
.credits-summary-layout .credit-task-total,
.credits-analytics > .panel {
  min-width: 0;
  margin: 0;
  padding: 20px 24px;
  border-radius: 16px;
  min-height: 210px;
}
.credits-summary-layout .balance,
.credit-task-total {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.credits-summary-layout .balance > strong,
.credit-task-total > strong {
  font-size: 36px;
  line-height: 1.15;
  margin: 16px 0;
  color: #f3f3f4;
}
.credits-summary-layout .balance > strong small {
  font-size: 13px;
}
.credits-summary-layout .balance .bartrack {
  margin: 0;
  height: 7px;
}
.credits-summary-layout .balance > p,
.credit-task-total > p {
  font-size: 12px;
  line-height: 1.6;
  margin: 12px 0 0;
  color: #aaaab3;
}
.credit-task-total {
  background: linear-gradient(140deg, #292e22, #222225 65%);
}
.credit-task-total .stathead {
  font-size: 13px;
  color: #b6b6bf;
}
.credit-task-total .iconbox {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.credit-task-total .iconbox svg {
  width: 19px;
  height: 19px;
}
.credit-total-caption,
.credit-panel-caption {
  font-size: 11px;
  line-height: 1.5;
  color: #85858f;
}
.credit-total-caption {
  margin-top: 5px;
}
.credits-analytics > .panel {
  min-height: 224px;
}
.credits-analytics .panelhead {
  padding: 0;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.credits-analytics h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.credits-analytics .panelhead > small {
  white-space: nowrap;
  font-size: 11px;
  color: #8c8c95;
}
.credit-distribution .distribution {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 10px 0 0;
}
.credit-distribution .barrow {
  grid-template-columns: 74px minmax(0, 1fr) 35px;
  gap: 10px;
  font-size: 12px;
}
.credit-distribution .barrow > span:last-child {
  text-align: right;
}
.credit-distribution .bartrack {
  height: 7px;
}
.credit-trend .chart {
  height: 138px;
  padding: 8px 0 0;
  gap: 10px;
}
.credit-trend .plot {
  min-width: 0;
}
.credit-trend .plot svg {
  height: 105px;
}
.credits-analytics .barfill {
  background: #c8e778;
}
@media (max-width: 760px) {
  .credits-summary-layout,
  .credits-analytics {
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
    gap: 14px;
    margin-bottom: 14px;
  }
  .credits-summary-layout .balance,
  .credits-summary-layout .credit-task-total,
  .credits-analytics > .panel {
    padding: 20px;
    min-height: 190px;
  }
  .credits-analytics .panelhead {
    flex-wrap: wrap;
  }
  .credit-task-total > strong {
    margin: 12px 0;
  }
}

.brand > div:last-child {
  min-width: 0;
}
.brand .logo {
  flex-shrink: 0;
}
.brand .brand-tagline {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0;
  color: #858589;
}

.account-class-group + .account-class-group {
  border-top: 1px solid var(--border);
}
.account-class-group > h3 {
  font-size: 15px;
  margin: 0;
  padding: 18px 20px;
  background: #292d24;
  color: #d8e5c2;
}
.account-class-group > h3 > span {
  font-size: 12px;
  font-weight: 400;
  color: #9ca78e;
  margin-left: 10px;
}
.account-filters #userclass {
  width: auto;
  min-width: 160px;
  max-width: 100%;
}

/* Shared usability: readable controls, visible focus, responsive navigation. */
button,
input,
select,
textarea,
a {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #c9f24c;
  outline-offset: 3px;
}
.primary,
.secondary,
.filter {
  min-height: 42px;
}
.textbtn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.textbtn:disabled {
  opacity: 0.45;
  cursor: default;
}
.pagehead,
.sectionhead {
  gap: 16px;
}
.pagehead p {
  line-height: 1.7;
}
.profile {
  min-width: 0;
}
.profile > div:last-child {
  min-width: 0;
}
.profile strong {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filterbar input,
.filterbar select {
  min-height: 44px;
}
.filterbar select {
  width: auto;
  max-width: 100%;
}
.tablewrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #697257 #242528;
}
.account-selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 15px 0;
  color: #b2b8a9;
  font-size: 13px;
}
.account-selection > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.account-select-cell {
  width: 52px;
  text-align: center;
  padding: 12px 10px;
}
.account-select-cell input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #c8e97f;
  cursor: pointer;
  vertical-align: middle;
}
.account-class-group h3 {
  display: flex;
  align-items: center;
  gap: 5px;
}
.selection-preview {
  margin-top: 16px;
  color: #aab39c;
  font-size: 13px;
}
.selection-preview summary {
  cursor: pointer;
  padding: 10px 0;
}
.selection-preview p {
  line-height: 1.8;
}
dialog {
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
dialog::backdrop {
  backdrop-filter: blur(5px);
}
dialog h2 {
  padding-right: 25px;
  line-height: 1.5;
}
dialog .modalclose {
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
}
dialog .modalclose:hover {
  background: #ffffff0b;
}
dialog .formactions {
  position: sticky;
  bottom: -28px;
  z-index: 2;
  margin: 22px -28px -28px;
  padding: 16px 28px;
  background: #222225;
  border-top: 1px solid #3a3c3a;
}
dialog .error {
  line-height: 1.7;
}
dialog input,
dialog select,
dialog textarea {
  min-height: 44px;
}
button[aria-busy='true'] {
  cursor: wait;
}
button[aria-busy='true']:before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes ui-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 900px) {
  .project-controls {
    flex-wrap: wrap;
    max-width: 100%;
  }
  .project-search {
    flex: 1;
    min-width: 140px;
  }
  .project-search input {
    width: 100%;
    min-width: 0;
  }
  .project-controls select {
    max-width: 150px;
  }
  .project-toolbar {
    gap: 14px;
  }
}
@media (max-width: 700px) {
  .sidebar {
    gap: 0;
    padding: 14px 14px 0;
  }
  .sidebar .brand {
    padding: 0 4px 14px;
  }
  .sidebar .brand > div:last-child {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: baseline;
  }
  .sidebar .brand small {
    margin: 0;
  }
  .sidebar .brand .brand-tagline {
    grid-column: 1/-1;
    margin-top: 3px;
    font-size: 11px;
  }
  .sidebar nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    gap: 5px;
    padding: 0 0 10px;
    scrollbar-width: thin;
    scrollbar-color: #53603b transparent;
  }
  .sidebar nav .nav {
    flex: none;
    white-space: nowrap;
    margin: 0;
    min-height: 44px;
    padding: 10px 12px;
  }
  .sidebar nav .nav.active {
    background: #ccff001a;
  }
  .topright {
    gap: 10px;
  }
  .topbar {
    padding: 0 16px;
  }
  .profile {
    padding: 0;
    gap: 8px;
  }
  .profile strong {
    max-width: 120px;
  }
  .profile small {
    font-size: 11px;
  }
  .content {
    padding: 24px 16px;
  }
  .primary,
  .secondary,
  .filter,
  .textbtn,
  .topright > button {
    min-height: 44px;
  }
  .topright > button:not(.profile) {
    min-width: 44px;
  }
  .filterbar {
    gap: 10px;
  }
  .filterbar input {
    max-width: none;
    flex: 1 1 100%;
  }
  .filterbar select {
    flex: 1 1 135px;
    min-width: 0;
    width: 100%;
  }
  .account-filters #userclass {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
  .account-selection {
    align-items: flex-start;
    flex-direction: column;
    font-size: 12px;
  }
  .account-selection > div {
    width: 100%;
    justify-content: flex-end;
  }
  .account-selection .secondary {
    min-width: 120px;
  }
  .account-select-cell {
    min-width: 48px;
  }
  .account-select-cell input {
    width: 24px;
    height: 24px;
  }
  .tablewrap td {
    padding: 14px 16px;
  }
  .tablewrap .account-select-cell {
    padding: 10px 12px;
  }
  .project-controls {
    width: 100%;
    margin: 0;
    gap: 10px;
    justify-content: flex-start;
  }
  .project-search {
    flex: 1 1 100%;
    min-width: 0;
  }
  .project-controls > select {
    flex: 1;
    max-width: none;
  }
  .view-toggle button {
    min-width: 40px;
    min-height: 36px;
  }
  .workspace-heading {
    align-items: flex-start;
  }
  .workspace-heading h1 {
    font-size: 28px;
  }
  .workspace-heading > .primary {
    white-space: nowrap;
    padding: 11px 14px;
  }
  .workspace-banner {
    padding: 20px;
    gap: 14px;
    flex-wrap: wrap;
  }
  .workspace-banner strong {
    font-size: 20px;
  }
  .workspace-banner .secondary {
    margin-left: 0;
  }
  .workspace-foot,
  .footer {
    flex-wrap: wrap;
    gap: 8px;
  }
  dialog {
    max-height: calc(100dvh - 24px);
    padding: 24px 20px;
    border-radius: 16px;
  }
  dialog .formactions {
    bottom: -24px;
    margin: 22px -20px -24px;
    padding: 14px 20px;
    gap: 10px;
  }
  dialog .formactions button {
    flex: 1;
  }
  dialog .modalclose {
    top: 10px;
    right: 10px;
  }
}
@media (max-width: 480px) {
  .topright .mode {
    display: none;
  }
  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .apps {
    grid-template-columns: minmax(0, 1fr);
  }
  .appcard {
    padding: 18px;
  }
  .appcard h4 {
    font-size: 16px;
  }
  .appcard p {
    font-size: 13px;
    min-height: 0;
  }
  .appmeta {
    font-size: 12px;
  }
  .pagehead h1 {
    font-size: 24px;
  }
}
@media (pointer: coarse) {
  input,
  textarea,
  select,
  .canvas-shell input,
  .canvas-shell textarea,
  .canvas-shell select {
    font-size: 16px !important;
  }
  .canvas-shell .cn-inline-text {
    font-size: 16px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
@media (min-width: 761px) and (max-width: 1050px) {
  .credits-summary-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: 700px;
  }
  .credits-analytics .panelhead {
    flex-wrap: wrap;
  }
}
@media (max-width: 700px) {
  .account-class-group > h3:after {
    content: '可左右滑動查看名單';
    font-size: 11px;
    font-weight: 400;
    color: #98a38a;
    margin-left: auto;
  }
  .account-class-group > h3 {
    gap: 3px;
    flex-wrap: wrap;
  }
}
.account-selection.has-selection {
  position: sticky;
  top: 12px;
  z-index: 12;
  background: #272c22;
  border: 1px solid #667847;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 8px 30px #0005;
}
.empty p {
  line-height: 1.8;
}
.empty .secondary,
.studio-empty .secondary {
  margin-top: 10px;
}
.credits-school-balances {
  margin-bottom: 24px;
}
.credits-school-balances .balance {
  min-width: 0;
}
.tablewrap:focus-visible {
  outline: 2px solid #c9f24c;
  outline-offset: -2px;
}
@media (max-width: 700px) {
  .school-account-summary:has(> span:nth-child(3)):not(:has(> span:nth-child(4))) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
  }
  .school-account-summary:has(> span:nth-child(3)):not(:has(> span:nth-child(4))) > span {
    font-size: 11px;
    min-width: 0;
    line-height: 1.6;
  }
  .school-account-summary:has(> span:nth-child(3)):not(:has(> span:nth-child(4))) strong {
    display: block;
    margin: 7px 0 0;
    font-size: 21px;
  }
  .account-selection.has-selection {
    top: 8px;
    padding: 10px 12px;
    gap: 5px;
  }
  .account-selection.has-selection > div {
    justify-content: space-between;
  }
}
.class-select-all {
  display: none;
}
@media (max-width: 700px) {
  .account-class-group > h3:after {
    display: none;
  }
  .account-class-group > h3 .class-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0 auto;
    min-height: 36px;
    font-size: 12px;
    color: #c4d1b2;
    cursor: pointer;
  }
  .class-select-all input {
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: #c8e97f;
  }
  .account-table {
    overflow: visible;
  }
  .account-table table,
  .account-table tbody {
    display: block;
    width: 100%;
    white-space: normal;
  }
  .account-table thead {
    display: none;
  }
  .account-table tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    padding: 18px;
    border-bottom: 1px solid #383c35;
  }
  .account-table tr:last-child {
    border-bottom: 0;
  }
  .account-table td {
    display: block;
    min-width: 0;
    padding: 0 !important;
    border: 0;
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }
  .account-table td:before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: #8e9886;
    margin-bottom: 4px;
  }
  .account-table .account-member {
    grid-column: 1/-1;
    padding-right: 40px !important;
    font-size: 16px;
    font-weight: 550;
  }
  .account-table .account-member:before {
    display: none;
  }
  .account-table .account-member .subtext {
    font-size: 12px;
    font-weight: 400;
    margin-top: 2px;
  }
  .account-table .account-select-cell {
    position: absolute;
    top: 10px;
    right: 8px;
    display: grid;
    place-items: center;
    min-width: 44px;
    width: 44px;
    height: 44px;
  }
  .account-table .account-select-cell:before {
    display: none;
  }
  .account-table .account-select-cell:empty {
    display: none;
  }
  .account-table .textbtn {
    padding: 0 8px 0 0;
    justify-content: flex-start;
  }
  .account-table .pill {
    display: inline-block;
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .topright {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }
}
