/* Interactive pieces: account menu, forms, applications and the admin dashboard.
   Loaded after styles.css and uses the same palette variables. */

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 14px;
}

.strong {
  font-weight: 600;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.hero h1 span {
  color: inherit;
}

.hero h1 .highlight {
  color: var(--gold);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-danger {
  background: transparent;
  border-color: rgba(229, 72, 77, 0.55);
  color: #ff8a8e;
}

.btn-danger:hover {
  background: rgba(229, 72, 77, 0.12);
}

.btn svg {
  flex: none;
}

/* -- account menu ------------------------------------------------------------ */

.account {
  display: flex;
  align-items: center;
  min-height: 40px;
}

.brand-tag {
  margin-left: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font: 600 11px/1.3 var(--body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.account-menu summary:hover {
  border-color: rgba(212, 175, 55, 0.5);
}

.account-menu summary img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.account-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
}

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  display: grid;
}

.account-dropdown a,
.account-dropdown button {
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: 500 14px/1.2 var(--body);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.account-dropdown a:hover,
.account-dropdown button:hover {
  background: rgba(232, 240, 234, 0.06);
}

/* -- inner pages ------------------------------------------------------------------ */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-main {
  flex: 1;
  padding-top: 48px;
  padding-bottom: 80px;
}

.narrow {
  max-width: 780px;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: clamp(34px, 5vw, 48px);
  text-transform: uppercase;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover {
  color: var(--ink);
}

.panel {
  padding: 32px;
  border-radius: var(--radius);
  background: var(--ground-2);
  border: 1px solid var(--line);
}

.panel + .panel {
  margin-top: 20px;
}

.notice h2,
.success h2 {
  font-size: 28px;
  text-transform: uppercase;
}

.notice p,
.success p {
  margin-top: 10px;
  color: var(--muted);
}

.success {
  text-align: center;
}

.success .form-actions {
  justify-content: center;
}

.success-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ground);
  font: 700 32px/1 var(--body);
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* -- department cards on the home page --------------------------------------------- */

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 22px;
}

.card-foot .status {
  margin: 0;
  padding: 0;
}

.status.closed .dot {
  background: #e5484d;
  box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.18);
}

/* -- apply page ------------------------------------------------------------------------ */

.apply-head {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 28px;
}

.apply-head img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
}

.apply-head h1 {
  margin-top: 10px;
  font-size: clamp(30px, 4.6vw, 42px);
  text-transform: uppercase;
}

.apply-head .tagline {
  margin-top: 6px;
  color: var(--gold);
  font-weight: 500;
}

.agency-list {
  display: grid;
  gap: 12px;
}

.agency {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--ground-2);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.agency:hover {
  border-color: rgba(212, 175, 55, 0.5);
}

.agency img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.agency-text {
  display: grid;
  gap: 2px;
  flex: 1;
}

.agency-text span {
  color: var(--muted);
  font-size: 14px;
}

.agency-arrow {
  color: var(--gold);
  font-size: 20px;
}

.agency.is-closed {
  opacity: 0.6;
}

/* -- forms ------------------------------------------------------------------------------- */

.form {
  display: grid;
  gap: 26px;
}

.applicant {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.applicant img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.field {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field-label {
  font-weight: 600;
  font-size: 15px;
  padding: 0;
}

.field-help {
  margin-top: -4px;
  color: var(--muted);
  font-size: 14px;
}

.req {
  color: var(--gold);
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(232, 240, 234, 0.16);
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 var(--body);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 48px;
}

select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aeb9cc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

input::placeholder,
textarea::placeholder {
  color: rgba(143, 167, 149, 0.6);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.counter {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

.choices {
  display: grid;
  gap: 8px;
}

.choices-inline {
  grid-template-columns: repeat(2, minmax(0, 160px));
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(232, 240, 234, 0.16);
  background: var(--ground);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.choice input,
.checkbox input,
.switch input {
  accent-color: var(--gold);
}

.choice input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.form-error {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(229, 72, 77, 0.12);
  border: 1px solid rgba(229, 72, 77, 0.4);
  color: #ffb3b5;
  font-size: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.form .form-actions {
  margin-top: 0;
  justify-content: flex-end;
}

/* -- status badges and my applications ---------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  font: 600 12px/1.2 var(--body);
  letter-spacing: 0.04em;
}

.badge-pending {
  background: rgba(212, 175, 55, 0.14);
  color: var(--gold);
}

.badge-accepted {
  background: rgba(46, 158, 91, 0.14);
  color: var(--green);
}

.badge-denied {
  background: rgba(229, 72, 77, 0.14);
  color: #ff8a8e;
}

.mine-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.mine-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--ground-2);
  border: 1px solid var(--line);
}

.mine-item p {
  margin-top: 4px;
}

.reason {
  margin-top: 10px;
  color: var(--ink);
  font-size: 14px;
}

/* -- admin -------------------------------------------------------------------------------- */

.tabs,
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.tab,
.subtab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: 600 15px/1 var(--body);
  cursor: pointer;
}

.tab:hover,
.subtab:hover {
  color: var(--ink);
}

.tab[aria-selected="true"],
.subtab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.subtabs {
  border-bottom: 0;
  gap: 8px;
}

.subtab {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px 8px 8px;
  margin: 0;
}

.subtab[aria-selected="true"] {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.subtab img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar select {
  width: auto;
  min-width: 170px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.counts {
  margin-left: auto;
}

.app-list {
  display: grid;
  gap: 8px;
}

.app-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--ground-2);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.app-row:hover {
  border-color: rgba(212, 175, 55, 0.45);
}

.app-row img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.app-row-main {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--ground-2);
  color: var(--ink);
}

.dialog::backdrop {
  background: rgba(4, 10, 7, 0.72);
  backdrop-filter: blur(3px);
}

.dialog-close {
  position: sticky;
  top: 12px;
  float: right;
  margin: 12px 12px 0 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.dialog-body {
  padding: 28px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.dialog-head > div {
  flex: 1;
  min-width: 0;
}

.dialog-head h2 {
  font-size: 26px;
}

.answers {
  display: grid;
  gap: 18px;
  margin: 22px 0 0;
}

.answers dt {
  font-weight: 600;
  color: var(--gold);
  font-size: 14px;
}

.answers dd {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.review-note,
.decision {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.decision {
  display: grid;
  gap: 10px;
}

.decision .form-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.group {
  margin: 0 0 20px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ground-2);
  display: grid;
  gap: 18px;
  min-width: 0;
}

.group legend {
  padding: 0 8px;
  margin-left: -8px;
  font: 700 18px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  align-items: end;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  font-weight: 500;
  cursor: pointer;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(232, 240, 234, 0.18);
  transition: background-color 0.15s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-track {
  background: var(--green);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.list-editor {
  display: grid;
  gap: 10px;
}

.list-editor > .btn {
  justify-self: start;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.list-row-stack {
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.list-row-fields {
  display: grid;
  gap: 8px;
  flex: 1;
}

.row-buttons {
  display: flex;
  gap: 4px;
  flex: none;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--ground);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
  border-color: rgba(212, 175, 55, 0.5);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn.danger:hover {
  border-color: rgba(229, 72, 77, 0.6);
  color: #ff8a8e;
}

.questions {
  display: grid;
  gap: 14px;
}

.questions > .btn {
  justify-self: start;
}

.question {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--ground);
}

.question input[type="text"],
.question input[type="number"],
.question textarea,
.question select {
  background: var(--ground-2);
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-number {
  font: 700 16px/1 var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
}

.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(16, 36, 26, 0.94);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.save-hint {
  display: none;
  margin-right: auto;
  color: var(--gold);
  font-size: 14px;
  font-weight: 500;
}

.save-bar.is-dirty {
  border-color: rgba(212, 175, 55, 0.55);
}

.save-bar.is-dirty .save-hint {
  display: inline;
}

/* -- toasts -------------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
}

.toast {
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  font-size: 14px;
}

.toast-success {
  border-color: rgba(46, 158, 91, 0.5);
}

.toast-error {
  border-color: rgba(229, 72, 77, 0.6);
  color: #ffb3b5;
}

/* -- Roblox account card ------------------------------------------------------------ */

.roblox-preview {
  display: grid;
  gap: 8px;
}

.roblox-preview:empty {
  display: none;
}

.roblox-note {
  color: var(--muted);
  font-size: 14px;
}

.roblox-note.error {
  color: #ffb3b5;
}

.roblox-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.roblox-card img,
.roblox-avatar-empty {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 10px;
  background: var(--ground);
}

.roblox-info {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 160px;
}

.roblox-info .badge {
  justify-self: start;
  margin-top: 4px;
}

.dialog-roblox {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

@media (max-width: 720px) {
  .panel,
  .group,
  .dialog-body {
    padding: 20px;
  }

  .apply-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .account-name {
    display: none;
  }

  .account-menu summary {
    padding-right: 4px;
  }

  .counts {
    margin-left: 0;
    width: 100%;
  }

  .mine-item {
    flex-direction: column;
  }
}
