:root {
  color-scheme: dark;
  font: 100%/1.5 system-ui, "Segoe UI", sans-serif;
  --bg: #100c14;
  --surface: #19131e;
  --surface-raised: #211825;
  --field: #120d16;
  --border: #3c2f43;
  --text: #faf5fa;
  --muted: #c2b2c6;
  --accent: #ffa0b6;
  --action: #ac214a;
  --action-hover: #bb2853;
  --green: #a0e8b9;
  --warn: #ffd0a0;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; }
h1 { font-size: clamp(2.15rem, 3.8vw, 3.5rem); letter-spacing: -.045em; }
h2 { font-size: 1.3rem; letter-spacing: -.025em; }
h3 { font-size: 1.03rem; }
p { overflow-wrap: break-word; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

button {
  min-height: 2.75rem;
  padding: .54rem .85rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  color: var(--text);
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
}
button:disabled { cursor: wait; opacity: .65; }
.primary { background: var(--action); border-color: #d35a7d; }
.primary:not(:disabled):hover { background: var(--action-hover); }
.secondary { background: var(--surface-raised); border-color: var(--border); }
.secondary:not(:disabled):hover { background: #312338; border-color: #704d63; }
:is(button, input, select, a):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

label { display: grid; gap: .4rem; font-size: .9rem; font-weight: 575; }
input, select {
  min-width: 0;
  width: 100%;
  min-height: 2.8rem;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background-color: var(--field);
  color: var(--text);
  font-size: 1rem;
}
input::placeholder { color: #ae99b1; opacity: 1; }
input:focus, select:focus { border-color: #d96887; }
select {
  appearance: none;
  padding-right: 2.1rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 50%, calc(100% - .75rem) 50%;
  background-repeat: no-repeat;
  background-size: .3rem .3rem;
}

.frame { width: min(calc(100% - 2.5rem), 75rem); margin-inline: auto; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-size: 1rem; font-weight: 780; letter-spacing: .005em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  flex: none;
  border: 1px solid #e0799a;
  border-radius: .6rem;
  background: #a91d47;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
}
.muted, .field-help, small { color: var(--muted); }
.field-help, small { font-size: .83rem; }

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 1.15rem;
  background: radial-gradient(ellipse at 48% 32%, #2b1329 0%, var(--bg) 62%);
}
.login-card {
  width: min(100%, 28rem);
  padding: clamp(1.3rem, 6vw, 2.25rem);
  border: 1px solid #624050;
  border-radius: 1rem;
  background: var(--surface);
}
.login-card .brand { margin-bottom: 1.6rem; }
.login-card h1 { font-size: clamp(2rem, 7vw, 2.65rem); }
.login-card > p { margin-top: .45rem; color: var(--muted); }
.login-card form { display: grid; gap: .85rem; margin-top: 1.45rem; }
.login-card button { margin-top: .2rem; }
.form-message { font-size: .9rem; }

.site-header { border-bottom: 1px solid var(--border); background: #18111b; }
.header-inner { min-height: 4.35rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.session { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; min-width: 0; }
.session-identity { min-width: 0; display: grid; justify-items: end; font-size: .88rem; line-height: 1.25; }
.session-identity strong { max-width: min(28vw, 13rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-identity span { font-size: .8rem; color: var(--muted); }
.session button { flex: none; }
.dashboard { padding-block: 2.1rem 3rem; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-heading p { margin-top: .4rem; color: var(--muted); }
.page-heading button { flex: none; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.notice {
  margin-bottom: 1rem;
  padding: .7rem .9rem;
  border: 1px solid #6b425c;
  border-radius: .55rem;
  background: #291a2a;
  font-size: .91rem;
}
.error { color: #ffc0c3; }
.notice.error { border-color: #975060; background: #351b29; }
.dashboard-content { display: grid; align-items: start; gap: 1.15rem; }
.dashboard-content.with-admin { grid-template-columns: minmax(0, 2.15fr) minmax(18rem, 1fr); }
.admin-panels { display: grid; gap: 1rem; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: .8rem; background: var(--surface); }
.panel-header { display: flex; align-items: end; justify-content: space-between; gap: .8rem; }
.creator-header { padding: 1.05rem 1.15rem; }
.creator-header p { margin-top: .25rem; font-size: .92rem; }
.search { width: min(100%, 15rem); }
.settings-panel { padding: 1.05rem 1.15rem; }
.settings-panel form { display: grid; gap: .7rem; margin-top: .9rem; }
.settings-panel form > button { margin-top: .18rem; }
.settings-panel .support-form { padding-top: .9rem; border-top: 1px solid var(--border); }

.creators-table { width: 100%; border-collapse: collapse; text-align: left; }
.creators-table th { border-block: 1px solid var(--border); background: var(--surface-raised); color: #ebd9eb; font-size: .85rem; font-weight: 680; white-space: nowrap; }
.creators-table :is(th, td) { padding: .7rem 1.15rem; }
.creators-table td { border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
.creators-table tbody tr:last-child td { border-bottom: 0; }
.creator-identity strong, .creator-identity small, .assigned-cell small { display: block; }
.creator-identity strong { font-size: .98rem; }
.creator-name { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .55rem; }
.rank-tag { padding: .12rem .42rem; border: 1px solid #6c405b; border-radius: .3rem; color: var(--accent); font-size: .8rem; white-space: nowrap; }
.remove-rank { min-height: 2rem; padding: .24rem .5rem; font-size: .8rem; color: var(--accent); border-color: #6e3750; }
.creator-identity small, .assigned-cell small { margin-top: .14rem; }
.creator-actions { text-align: right; }
.creators-table th:last-child { text-align: right; }
.profile-link { color: var(--accent); font-weight: 680; text-decoration-thickness: .08em; text-underline-offset: .18em; }
.profile-link:hover { color: #ffd0db; }
.empty { padding: 1.2rem 1.15rem; border-top: 1px solid var(--border); color: var(--muted); }
.support-list { padding: 0; margin: .8rem 0 0; list-style: none; }
.support-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .58rem 0; border-bottom: 1px solid var(--border); }
.support-row:last-child { border-bottom: 0; }
.support-identity { display: grid; min-width: 0; overflow-wrap: anywhere; }
.support-active { color: var(--green); }
.support-inactive { color: var(--warn); }
#supports-list > p { margin-top: .7rem; }

dialog {
  width: min(calc(100% - 1.7rem), 29rem);
  max-height: calc(100% - 1.7rem);
  padding: 1.25rem;
  border: 1px solid #785164;
  border-radius: .8rem;
  background: var(--surface);
  color: var(--text);
  overscroll-behavior: contain;
}
dialog::backdrop { background: #100911b8; }
dialog form { display: grid; gap: .8rem; }
dialog form > p:first-of-type { margin-top: -.2rem; color: var(--muted); }
#assignment-field:empty { display: none; }
.with-prefix { display: flex; align-items: center; border: 1px solid var(--border); border-radius: .5rem; background: var(--field); }
.with-prefix > span { padding-left: .72rem; color: var(--muted); font-size: 1rem; }
.with-prefix input { padding-left: .35rem; border: 0; background: transparent; }
.with-prefix:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.with-prefix input:focus-visible { outline: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.registration-lookup { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .55rem; }
dialog .registration-player { padding: .65rem .75rem; border: 1px solid #45604c; border-radius: .45rem; background: #16281e; color: #c5eed0; }

@media (max-width: 850px) {
  .dashboard-content.with-admin { grid-template-columns: minmax(0, 1fr); }
  .admin-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 560px) {
  .frame { width: calc(100% - 1.5rem); }
  .header-inner { min-height: 4rem; }
  .brand { gap: .46rem; font-size: .95rem; }
  .brand-mark { width: 2rem; height: 2rem; font-size: 1.12rem; }
  .session { gap: .42rem; }
  .session button { padding-inline: .55rem; font-size: .85rem; }
  .session-identity { font-size: .82rem; }
  .session-identity span { font-size: .76rem; }
  .dashboard { padding-top: 1.3rem; }
  .page-heading { align-items: start; flex-direction: column; gap: .7rem; margin-bottom: 1.1rem; }
  .page-actions { justify-content: flex-start; }
  .creator-header { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .admin-panels { grid-template-columns: minmax(0, 1fr); }
  .creators-table { display: block; }
  .creators-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .creators-table :is(tbody, tr, td) { display: block; }
  .creators-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .4rem .55rem;
    border-top: 1px solid var(--border);
    padding: .8rem 1.05rem;
  }
  .creators-table tbody td { padding: 0; border-bottom: 0; }
  .creator-identity { grid-column: 1; grid-row: 1; }
  .creator-actions { grid-column: 2; grid-row: 1 / 3; align-self: start; }
  .profile-cell, .assigned-cell { grid-column: 1; font-size: .9rem; }
  .assigned-cell::before { content: 'Soporte '; color: var(--muted); }
  .assigned-cell small { display: inline; margin-left: .4rem; }
  .dialog-actions > button { flex: 1; }
}
@media (pointer: coarse) {
  .remove-rank { min-height: 2.75rem; }
}
