/* My account (#/account) and the admin Control room (#/admin/...).
   Only theme variables from app.css are used, so light and dark both work. */

/* ---------- Shared bits ---------- */
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

.pw-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pw-wrap .input { flex: 1; font-family: var(--font-mono); font-size: 13.5px; }
.pw-wrap .btn { flex: none; }

/* Colour choice: round swatches (radio buttons) */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch-dot {
  width: 26px; height: 26px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.swatch:hover .swatch-dot { transform: scale(1.08); }
.swatch input:checked + .swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch input:focus-visible + .swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--teal), var(--focus); }
.swatch-custom {
  width: 34px; height: 34px; padding: 3px; cursor: pointer;
  border: 1px dashed var(--line-2); border-radius: 50%; background: var(--surface-2);
}
.swatch-custom::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-custom::-webkit-color-swatch { border: 0; border-radius: 50%; }
.swatch-custom::-moz-color-swatch { border: 0; border-radius: 50%; }

/* On / off switch */
.switch { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; width: 34px; height: 20px; flex: none; border-radius: var(--radius-pill);
  background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background .15s var(--ease);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-3); transition: transform .15s var(--ease), background .15s var(--ease);
}
.switch input:checked + .switch-track { background: var(--teal); box-shadow: none; }
.switch input:checked + .switch-track::after { transform: translateX(14px); background: var(--teal-ink); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch input:disabled + .switch-track { opacity: .5; }

/* Username + password to send a new member */
.cred-box { display: flex; flex-direction: column; gap: 2px; padding: 6px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.cred-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.cred-line:last-child { border-bottom: 0; }
.cred-line b { font-weight: 500; word-break: break-all; text-align: right; user-select: all; }

/* ---------- My account ---------- */
.acct-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.acct-id-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acct-id-text b { font-size: 19px; font-weight: 600; }

.theme-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-choices .choice { padding: 14px; gap: 4px; }
.theme-choices .choice b { font-size: 15px; }
.theme-choices .choice span { font-size: 12.5px; }

.acct-change { align-items: start; }
.acct-change-text { font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; }

.acct-admin-link .card-body { gap: 14px; }
.acct-admin-link b { font-size: 16px; color: var(--text); }
.acct-admin-link > .card-body > svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.acct-admin-icon {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px;
  background: var(--teal-soft); color: var(--teal);
}
.acct-admin-icon svg { width: 20px; height: 20px; }
.acct-signout { height: 48px; font-size: 15.5px; }

/* ---------- Control room ---------- */
.admin-tabs { align-self: flex-start; }
.admin-body { min-width: 0; }

.adm-row { gap: 10px 16px; }
.adm-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.adm-who-text { min-width: 0; flex: 1; }
.adm-row .row-title { flex-wrap: wrap; row-gap: 4px; }
.adm-row .row-title > .ellipsis { max-width: 100%; }
.adm-row .row-actions { align-items: center; flex-wrap: wrap; }
.adm-off .adm-who { opacity: .62; }
.adm-danger { color: var(--down); }
.adm-danger:hover { color: var(--down); background: var(--down-soft); }
.adm-up svg { transform: rotate(180deg); }
.adm-busy { opacity: .6; pointer-events: none; }
.adm-desc { margin-top: 4px; max-width: 70ch; overflow-wrap: anywhere; }
.adm-detail { margin-top: 4px; overflow-wrap: anywhere; }
.adm-roles .notice { align-items: flex-start; }
.adm-roles b { color: var(--text); }

.adm-part-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px var(--surface-3); }
.adm-dot-off { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }

.adm-tg-icon {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--teal-soft); color: var(--teal);
}
.adm-tg-icon svg { width: 16px; height: 16px; }
.adm-tg-actions { gap: 2px 8px; }

/* How-to steps */
.adm-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 16px; }
.adm-steps li { counter-increment: step; display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; }
.adm-steps li::before {
  content: counter(step); grid-row: span 2;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--lime-soft); color: var(--text); font: 600 14px var(--font-mono);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.adm-steps b { font-weight: 600; }
.adm-steps span { color: var(--text-2); font-size: 13.5px; }

/* Small numbers (bot status) */
.adm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.adm-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.adm-stat b { font: 500 22px var(--font-mono); }
.adm-stat span { font-size: 12px; color: var(--text-3); }

/* Part kind choice (radio inside a big button) */
.adm-kind { position: relative; }
.adm-kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.adm-kind:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.adm-kind:has(input:focus-visible) { box-shadow: var(--focus); }

/* Activity */
.adm-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 12px; padding-top: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.audit-table td { vertical-align: top; }
.audit-table .adm-when { white-space: nowrap; }
.audit-table .adm-when > span { display: block; }
.audit-table .adm-when > span + span { margin-top: 2px; }
.audit-table .adm-by { max-width: 200px; }
.audit-table .adm-what { white-space: nowrap; }
.audit-table .adm-summary { min-width: 260px; overflow-wrap: anywhere; line-height: 1.45; }
.adm-more { display: flex; justify-content: center; }

/* System */
.adm-example {
  display: flex; align-items: center; gap: 8px; margin-top: -4px;
  font: 500 13px var(--font-mono); color: var(--text-2);
}
.adm-example svg { width: 15px; height: 15px; color: var(--warn); flex: none; }
.adm-status { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.adm-status-card { border-radius: var(--radius); }
.adm-status-card .card-body { padding: 16px 18px; }
.adm-status-title { gap: 8px; margin-bottom: 4px; }
.adm-status-title svg { width: 17px; height: 17px; color: var(--teal); flex: none; }
.adm-kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13.5px; min-width: 0; }
.adm-kv b { font-weight: 500; font-family: var(--font-mono); text-align: right; }
.adm-kv.down b { color: var(--down); }

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  /* Five tabs side by side: icon above a small label */
  .admin-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; align-self: stretch; border-radius: 16px; }
  .admin-tabs .tab { flex-direction: column; justify-content: center; height: auto; min-height: 50px; padding: 6px 2px; gap: 3px; font-size: 11.5px; border-radius: 12px; }

  .adm-row { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .adm-row .row-actions { justify-content: flex-start; margin-left: 44px; }
  .admin-page .list-row, .acct-page .list-row { padding-left: 16px; padding-right: 16px; }
  .admin-page .card-head, .acct-page .card-head { padding: 16px; flex-wrap: wrap; }
  .admin-page .card-body, .acct-page .card-body { padding: 16px; }

  .theme-choices .choice { padding: 12px 10px; }
  .theme-choices .choice span { display: none; }

  .adm-stats { gap: 6px; }
  .adm-stat { padding: 8px 10px; }
  .adm-stat b { font-size: 19px; }

  .adm-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* The change log turns from a table into a list */
  .audit-table thead { display: none; }
  .audit-table, .audit-table tbody { display: block; }
  .audit-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--line);
  }
  .audit-table tr:last-child { border-bottom: 0; }
  .audit-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .audit-table tbody tr:hover td { background: transparent; }
  .audit-table .adm-by { grid-column: 1; grid-row: 1; max-width: none; }
  .audit-table .adm-when { grid-column: 2; grid-row: 1; text-align: right; }
  .audit-table .adm-when .tiny { display: none; }
  .audit-table .adm-what { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
  .audit-table .adm-summary { grid-column: 1 / -1; grid-row: 3; min-width: 0; font-size: 13.5px; }
}

@media (max-width: 420px) {
  .adm-row .row-actions { margin-left: 0; }
  .pw-wrap { flex-wrap: wrap; }
  .pw-wrap .input { flex-basis: 100%; }
}
