/* Admin section shell and jump list. Motion is 200–220ms, inside 150–250ms. */
.admin-panel { --card-line: #e6e4df; padding: 24px; }
[data-theme="dark"] .admin-panel { --card-line: #2A2C30; }

.admin-panel > .head {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin: 0;
}
.admin-panel > .head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--text);
}
.admin-panel .upd {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.admin-panel .upd .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
}
.admin-panel .upd button {
  font: inherit;
  font-size: 12px;
  color: var(--accent-text);
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
  min-width: 8em; /* wider than "Refreshing…" plus the 10px ring, so the button never grows */
  text-align: right;
  white-space: nowrap;
  cursor: pointer;
}
.admin-panel .upd button.is-busy {
  color: var(--text-3);
  cursor: default;
}
.admin-panel .upd button.is-busy::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: -1px;
  animation: admin-spin .8s linear infinite;
}
@keyframes admin-spin {
  to { transform: rotate(360deg); }
}
.admin-panel .upd button:focus-visible { box-shadow: var(--focus); }
.admin-panel > .mod.apanel:focus { outline: none; box-shadow: var(--focus); }
.admin-panel > .jump a:focus-visible { box-shadow: var(--focus); }

.admin-panel > .jump {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  margin: 0;
  font-size: 12px;
}
.admin-panel > .jump a {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  text-decoration: none;
  background: var(--surface);
}
.admin-panel > .jump a:hover { text-decoration: none; }
.admin-panel > .jump a b {
  color: var(--text-3);
  font-weight: 500;
  margin-left: 4px;
}

.admin-panel > .mod.apanel {
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
  margin: 0;
}

.admin-panel button.mh {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 14px 18px;
  min-height: 0;
  border: 1px solid var(--card-line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
  text-align: left;
  cursor: pointer;
}
.admin-panel button.mh:focus-visible { box-shadow: var(--focus); }
.admin-panel .mod.open button.mh { border-radius: 12px 12px 0 0; }
.admin-panel .mh h2 {
  margin: 0;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  line-height: 1.25;
}
.admin-panel .ic {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 14px;
}
.admin-panel .mh .n,
.admin-panel .mh .count {
  display: inline;
  flex: none;
  height: auto;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  gap: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
}
.admin-panel .mh .ks {
  margin-left: auto;
  min-width: 0;
  font-size: 13px;
  color: var(--text-2);
}
.admin-panel .mh .ks b { color: var(--text); font-weight: 600; }
.admin-panel .chev {
  width: 24px;
  flex: none;
  text-align: center;
  color: var(--text-3);
  display: inline-block;
  transition: transform .2s ease-out;
}
.admin-panel .mod:not(.open) .chev { transform: rotate(-90deg); }

.admin-panel .mb {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  min-width: 0;
  border: 1px solid var(--card-line);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: var(--surface);
  transition: grid-template-rows .22s ease-out, opacity .22s ease-out, border-width .22s ease-out;
}
.admin-panel .mb > div { overflow: hidden; min-height: 0; }
.admin-panel .mod:not(.open) .mb {
  grid-template-rows: 0fr;
  opacity: 0;
  border-width: 0;
}

.admin-panel .ap-fresh {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.admin-panel .ap-fresh .meta {
  margin-left: 0;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  gap: 6px;
  align-items: center;
}
.admin-panel .ap-fresh .btn { margin-left: auto; }

.admin-panel > .stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}
.admin-panel > .stats .stat {
  display: flow-root;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: 12px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
  transition: transform .2s ease-out, box-shadow .2s ease-out;
}
.admin-panel > .stats .stat:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}
.admin-panel > .stats .stat:focus-visible { box-shadow: var(--focus); border-radius: 12px; }
.admin-panel > .stats .stat.ex { border-style: dashed; opacity: .7; }
.admin-panel .stat .k {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.admin-panel .stat .v {
  display: block;
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.admin-panel .stat .v small { color: var(--text-3); font-size: 12px; font-weight: 400; }
.admin-panel .stat .s { display: block; margin-top: 2px; font-size: 12px; color: var(--text-2); }
.admin-panel .stat .sum-ex { color: var(--danger); }
.admin-panel .spark { float: right; margin-top: -2px; }
.admin-panel .spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.admin-panel .spark.draw path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: admin-spark .2s ease-out forwards;
}
@keyframes admin-spark {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@media (max-width: 720px) {
  .admin-panel { padding: var(--sp-3); }
}
@media (prefers-reduced-motion: reduce) {
  .admin-panel .chev,
  .admin-panel .mb,
  .admin-panel > .stats .stat { transition: none; }
  .admin-panel .spark.draw path { animation: none; stroke-dashoffset: 0; }
  .admin-panel .upd button.is-busy::before { animation: none; display: none; }
}
