.adm {
  --adm-bg: var(--paper, #f8f7f2);
  --adm-panel: var(--surface, #fffef9);
  --adm-soft: var(--linen, #efefe6);
  --adm-border: var(--line, #cfd5c9);
  --adm-text: var(--ink, #283b30);
  --adm-heading: var(--deep, #244331);
  --adm-muted: var(--muted, #566658);
  --adm-action: var(--forest, #31573e);
  --adm-on-action: var(--on-action, #fff);
  --adm-error: #954637;
  margin: 0;
  min-height: 100vh;
  background: var(--adm-bg);
  color: var(--adm-text);
  font-family: var(--sans, system-ui);
}
html[data-theme="dark"] .adm { --adm-error: #f2aa9c; }
.adm *, .adm *::before, .adm *::after { box-sizing: border-box; }
.adm [hidden] { display: none !important; }
.adm-wrap { width: min(1120px, calc(100% - clamp(2rem, 8vw, 7rem))); margin-inline: auto; }
.adm-header { border-bottom: 1px solid var(--adm-border); background: var(--adm-panel); }
.adm-top, .adm-header-actions, .adm-intro, .adm-section-head, .adm-directory-head, .adm-dialog-actions {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.adm-top { gap: 1rem; min-height: 4.6rem; padding-block: .45rem; }
.adm .brand { color: var(--adm-heading); }
.adm .brand img { width: 2.25rem; height: 2.25rem; object-fit: contain; border-radius: .45rem; }
.adm-brand-label { border-left: 1px solid var(--adm-border); padding-left: .95rem; color: var(--adm-muted); font-size: .875rem; }
.adm-header-actions { margin-left: auto; gap: .5rem; }
.adm h1, .adm h2 { font-family: var(--serif,Georgia,serif); color: var(--adm-heading); font-weight: 400; letter-spacing: -.03em; }
.adm h1 { margin: .1rem 0 .5rem; font-size: clamp(2.25rem, 5.4vw, 3.6rem); line-height: 1.04; }
.adm h2 { margin: 0; font-size: clamp(1.55rem, 2.8vw, 2rem); line-height: 1.15; }
.adm p { line-height: 1.55; }
#admin-main:focus { outline: 0; }
.adm :focus-visible { outline: 3px solid var(--focus-ring,#916420); outline-offset: 3px; }
.adm-button, .adm-primary, .adm-text-button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 44px;
  padding: .55rem .95rem; border: 1px solid var(--adm-border); border-radius: .6rem;
  background: var(--adm-panel); color: var(--adm-heading); font: 650 .9rem/1.2 var(--sans,system-ui); cursor: pointer;
}
.adm-primary { background: var(--adm-action); color: var(--adm-on-action); border-color: var(--adm-action); }
.adm-text-button { background: transparent; border-color: transparent; text-decoration: underline; text-underline-offset: .18em; }
.adm button:disabled { opacity: .65; cursor: wait; }
.adm label { display: block; margin: .8rem 0 .3rem; color: var(--adm-text); font: 650 .89rem/1.4 var(--sans,system-ui); }
.adm input {
  width: 100%; min-width: 0; min-height: 46px; padding: .6rem .72rem;
  border: 1px solid var(--adm-border); border-radius: .5rem; background: var(--adm-panel);
  color: var(--adm-text); font: 400 1rem/1.4 var(--sans,system-ui);
}
.adm input::placeholder { color: var(--adm-muted); }
.adm .adm-message, .adm .adm-help, .adm-session { color: var(--adm-muted); font-size: .88rem; }
.adm .adm-message:empty { display: none; }
.adm .adm-error { color: var(--adm-error); }
#adm-loading { margin-block: 4rem; }
.adm-login {
  display: grid; grid-template-columns: minmax(14rem, .85fr) minmax(0, 1.15fr);
  max-width: 54rem; margin: clamp(2rem, 7vh, 5rem) auto; border: 1px solid var(--adm-border);
  border-radius: 1.25rem; overflow: hidden; background: var(--adm-panel);
}
.adm-login-image { background: #2c4938 url("/assets/entardecer.webp") 66% center / cover no-repeat; }
.adm-login-content { min-width: 0; padding: clamp(1.4rem, 4vw, 3.3rem); }
.adm-login h1 { font-size: clamp(2.15rem, 4.2vw, 3.2rem); }
.adm-login-content > p { margin: .7rem 0 1.4rem; color: var(--adm-muted); }
.adm-login .adm-primary { margin-top: 1.15rem; width: 100%; }
#adm-dashboard { padding-bottom: 3.5rem; }
.adm-intro { align-items: end; justify-content: space-between; margin: clamp(1.5rem, 5vw, 3.8rem) 0 2rem; }
.adm-study {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 23rem; padding: .8rem 1rem; border: 1px solid var(--adm-border); border-radius: .65rem;
  background: var(--adm-soft); color: var(--adm-heading); text-decoration: none;
}
.adm-study > span:first-child { min-width: 0; }
.adm-study strong, .adm-study small { display: block; }
.adm-study strong { font-family: var(--serif,Georgia,serif); font-size: 1.28rem; font-weight: 400; }
.adm-study small { margin-top: .2rem; color: var(--adm-muted); font-size: .83rem; line-height: 1.42; }
.adm-study > span:last-child { color: var(--adm-action); font-size: 1.25rem; }
.adm-login .adm-study { margin-top: 1rem; }
#adm-create { margin-top: .65rem; }
.adm-row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .45rem; }
.adm-row-actions a { text-decoration: none; }
.adm-audit { list-style: none; padding: 0; margin: .8rem 0 1.1rem; }
.adm-audit li { padding: .65rem 0; border-top: 1px solid var(--adm-border); }
.adm-audit small { display: block; color: var(--adm-muted); }
.adm .adm-danger { color: var(--adm-error); border-color: currentColor; }
.adm .adm-danger:disabled { opacity: .5; }
.adm-session { margin: 0 0 .45rem; }
#adm-own-password { padding-inline: 0; }
.adm-section-head, .adm-directory-head { justify-content: space-between; }
.adm-overview .adm-section-head { margin-bottom: .7rem; }
#adm-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0;
  border: 1px solid var(--adm-border); border-radius: .85rem; overflow: hidden; background: var(--adm-panel);
}
#adm-metrics:empty { display: none; }
#adm-metrics > div { min-width: 0; padding: .95rem 1.2rem; border-bottom: 1px solid var(--adm-border); }
#adm-metrics dt { color: var(--adm-muted); font-size: .85rem; }
#adm-metrics dd { margin: .15rem 0 0; color: var(--adm-heading); font: 400 2.15rem/1.1 var(--serif,Georgia,serif); overflow-wrap: anywhere; }
#adm-metrics > div:nth-child(n+5) { border-bottom: 0; }
.adm-directory { margin-top: 2rem; }
.adm-directory-head { align-items: end; gap: .8rem 1rem; }
#adm-search { max-width: 100%; }
#adm-search label { margin-top: 0; }
#adm-search > div { display: flex; gap: .38rem; }
#adm-search input { max-width: 17rem; }
#adm-list-status { margin: .75rem 0; }
.adm-table { border-collapse: separate; border-spacing: 0; width: 100%; border: 1px solid var(--adm-border); border-radius: .75rem; overflow: hidden; background: var(--adm-panel); }
.adm-table th, .adm-table td { text-align: start; padding: .65rem .85rem; overflow-wrap: anywhere; }
.adm-table th { color: var(--adm-heading); }
.adm-table thead { background: var(--adm-soft); color: var(--adm-muted); font-size: .81rem; }
.adm-table tbody { font-size: .94rem; }
.adm-table tbody tr + tr > * { border-top: 1px solid var(--adm-border); }
.adm-table td:last-child { text-align: end; }
.adm-you, .adm-date { color: var(--adm-muted); font-size: .84rem; }
.adm-you { display: block; font-weight: 400; }
.adm-active, .adm-paused { display: inline-flex; align-items: center; gap: .37rem; }
.adm-active::before, .adm-paused::before { content: ""; width: .47rem; height: .47rem; background: currentColor; border-radius: 50%; }
.adm-active { color: var(--adm-heading); }
.adm-paused { color: var(--adm-error); }
#adm-more { margin-top: .9rem; }
#adm-dialog {
  width: min(31rem, calc(100% - 1.5rem)); max-height: 90dvh; overflow: auto;
  padding: clamp(1rem, 4vw, 1.6rem); border: 1px solid var(--adm-border); border-radius: .95rem;
  color: var(--adm-text); background: var(--adm-panel);
}
#adm-dialog::backdrop { background: rgb(12 24 17 / .73); }
#adm-dialog h2 { max-width: 100%; overflow-wrap: anywhere; }
#adm-dialog label input { display: block; margin-top: .3rem; }
.adm-manage { display: grid; gap: .5rem; margin-top: 1rem; }
.adm-manage button { justify-content: flex-start; text-align: left; }
.adm-dialog-actions { margin-top: .9rem; }
.adm-help { margin: .25rem 0 .7rem; }
.adm-key { display: block; overflow-wrap: anywhere; background: var(--adm-soft); padding: .9rem; border-radius: .5rem; font-family: ui-monospace,monospace; user-select: all; }
.adm-toast:not(:empty) {
  position: fixed; z-index: 3; bottom: calc(1rem + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); width: max-content; max-width: min(32rem, calc(100vw - 2rem));
  margin: 0; padding: .65rem .95rem; border: 1px solid var(--adm-border); border-radius: .6rem;
  background: var(--adm-action); color: var(--adm-on-action); font-size: .9rem;
}
.adm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (hover: hover) {
  .adm-study:hover strong { text-decoration: underline; text-underline-offset: .18em; }
  .adm-button:hover, .adm-text-button:hover { background: var(--adm-soft); }
  .adm-primary:hover { filter: brightness(1.09); }
}
@media (max-width: 700px) {
  .adm-study { width: 100%; }
  .adm-row-actions { justify-content: flex-start; }
  .adm-login { grid-template-columns: 1fr; max-width: 30rem; }
  .adm-login-image { height: 5rem; background-position: center 50%; }
  .adm-brand-label { display: none; }
  #adm-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #adm-metrics > div:nth-child(n+5) { border-bottom: 1px solid var(--adm-border); }
  #adm-metrics > div:last-child { border-bottom: 0; }
  .adm-table, .adm-table tbody, .adm-table tr, .adm-table th, .adm-table td { display: block; }
  .adm-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .adm-table tbody tr { padding: .85rem; }
  .adm-table tbody tr + tr { border-top: 1px solid var(--adm-border); }
  .adm-table tbody tr + tr > * { border: 0; }
  .adm-table th, .adm-table td { padding: .15rem 0; }
  .adm-table tbody th { font-size: 1.06rem; margin-bottom: .35rem; }
  .adm-table td[data-label] { display: grid; grid-template-columns: 5rem minmax(0,1fr); align-items: baseline; }
  .adm-table td[data-label]::before { content: attr(data-label); font-size: .81rem; color: var(--adm-muted); }
  .adm-table td:last-child { text-align: start; margin-top: .35rem; }
}
@media (max-width: 400px) {
  .adm-top { gap: .35rem; }
  .adm .brand { font-size: 1.28rem; }
  .adm .brand img { width: 1.7rem; height: 1.7rem; }
  .adm-top .adm-button { padding-inline: .55rem; }
  .adm-header-actions { gap: .2rem; }
  #adm-metrics > div { padding: .8rem; }
}
