/* Trang quản trị: bảng gọn, dễ quét. */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: var(--surround); color: #fff;
}
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; text-decoration: none; }
.bar-user { display: flex; align-items: center; gap: 12px; font-size: 0.875rem; }
.bar-user #admin-email { opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36vw; }
.bar .button-quiet { background: rgb(255 255 255 / 0.1); color: #fff; border-color: rgb(255 255 255 / 0.3); }
.bar .button-quiet:hover { background: rgb(255 255 255 / 0.18); border-color: #fff; }

.button-sm { white-space: nowrap; min-height: 38px; padding: 0 14px; font-size: 0.875rem; font-weight: 600; }

.admin { width: min(1080px, 100%); margin: 0 auto; padding: 28px 16px 48px; }

.login {
  max-width: 400px; margin: 24px auto; padding: 28px 24px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
}
.login h1 { font-size: 1.375rem; font-weight: 800; }
.login > p { margin: 6px 0 22px; color: var(--ink-2); font-size: 0.9375rem; }

.summary {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  padding: 16px 20px; margin-bottom: 20px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.summary-stats { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 0.9375rem; color: var(--ink-2); }
.summary-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.summary-stats .is-full b { color: var(--danger); }
.summary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }

.switch { display: inline-flex; align-items: center; gap: 10px; margin: 0; font-size: 0.9375rem; font-weight: 500; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; width: 40px; height: 24px; flex: none;
  background: var(--rule-strong); border-radius: 999px; transition: background-color 150ms;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 200ms var(--ease-out);
}
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2.5px solid var(--focus); outline-offset: 2px; }

.groups { display: grid; gap: 20px; }
.group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--rule);
}
.group-head h2 { font-size: 1.0625rem; font-weight: 800; }
.group-head span { font-size: 0.875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.group-head h2 span { margin-left: 6px; font-weight: 600; }
.group-schedule { margin: 2px 0 0; font-size: 0.875rem; color: var(--ink-2); }
.group-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.course-form { display: grid; gap: 0 16px; padding: 16px 20px 4px; border-bottom: 1px solid var(--rule); }
@media (min-width: 720px) { .course-form { grid-template-columns: 2fr 1fr; } .course-schedule, .course-form .row-actions { grid-column: 1 / -1; } }
.course-form .row-actions { justify-content: flex-start; margin-bottom: 16px; }
.group-empty { margin: 0; padding: 16px 20px; color: var(--ink-3); }

.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th {
  text-align: left; font-size: 0.8125rem; font-weight: 600; color: var(--ink-3);
  padding: 10px 12px; background: var(--surface-2);
}
.table td { padding: 10px 12px; border-top: 1px solid var(--rule); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; width: 3em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .name { font-weight: 600; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.row-actions select { width: auto; min-height: 38px; padding: 6px 10px; font-size: 0.875rem; }
.icon-button {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  background: none; border: 1.5px solid var(--rule-strong); border-radius: var(--radius-sm);
  color: var(--ink-2); cursor: pointer; transition: all 150ms;
}
.icon-button:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }
.icon-button.is-delete:hover { border-color: var(--danger); color: var(--danger); }
.icon-button:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-button[aria-pressed="true"] { background: var(--ball); border-color: var(--ball-deep); color: var(--ball-ink); }
.icon-button.is-armed { background: var(--danger); border-color: var(--danger); color: #fff; width: auto; padding: 0 10px; font: inherit; font-size: 0.8125rem; font-weight: 700; }

@media (max-width: 720px) {
  .bar-user #admin-email { display: none; }
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 2.25em 1fr; gap: 2px 8px; padding: 12px 16px; border-top: 1px solid var(--rule); }
  .table td { padding: 0; border: 0; }
  .table td:first-child { grid-row: 1 / span 5; padding: 0; width: auto; }
  .table td:last-child { padding: 8px 0 0; }
  .row-actions { justify-content: flex-start; }
}

.form-ok { margin: 0 0 14px; padding: 10px 12px; background: var(--ok-soft); color: var(--ok); border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500; }
.account { margin-top: 20px; }
.password-form { display: grid; gap: 0 16px; padding: 18px 20px 20px; align-items: end; }
@media (min-width: 720px) { .password-form { grid-template-columns: 1fr 1fr auto; } .password-form .button { margin-bottom: 18px; } }
.password-form .form-ok, .password-form .field-error { grid-column: 1 / -1; margin: 0; }

.swap-banner {
  position: sticky; top: 8px; z-index: 2;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--ball-ink); color: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.swap-banner svg { color: var(--ball); }
.swap-banner span { flex: 1; min-width: 200px; }
.swap-banner .button-quiet { background: rgb(255 255 255 / 0.1); color: #fff; border-color: rgb(255 255 255 / 0.35); }
.table tr.is-swap-source td { background: #f7fbd2; }
.table tr.is-swap-candidate:hover td { background: var(--surface-2); }
.swap-target { width: auto; font-size: 0.8125rem; min-height: 36px; box-shadow: inset 0 -2px 0 var(--ball-deep); }
.swap-target svg { width: 1.1em; height: 1.1em; }
.table tr.is-editing td { background: var(--surface-2); }
.table tr.is-editing input { min-height: 38px; padding: 6px 10px; font-size: 0.9375rem; }
.table .edit-name { display: grid; gap: 6px; }
.row-actions .button-ball { width: auto; }
