.manage-wide { width: min(880px, calc(100% - 32px)); }

.manage-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.manage-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.manage-nav a,
.manage-nav span {
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}

.manage-nav a { color: var(--accent); }

.manage-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.manage-nav span { color: var(--muted); }

.manage-bar h1 { font-size: 1.4rem; }

button.quiet {
  width: auto;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.question-index {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.question-index li[data-question-id] {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.question-index a {
  display: flex;
  flex: 1;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0 14px 14px 0;
  color: inherit;
  text-decoration: none;
}
.drag-handle {
  width: auto;
  border-radius: 14px 0 0 14px;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
  border-right: 0;
  padding: 0 12px;
  cursor: grab;
  font-size: 1.2rem;
}
.drag-handle:active { cursor: grabbing; }
.question-index li.dragging { opacity: 0.45; }
.question-index li.drop-target a,
.question-index li.drop-target .drag-handle { border-color: var(--accent); }

.question-index strong { display: block; }
.question-index small { color: var(--muted); }
.order {
  min-width: 2.5rem;
  color: var(--accent);
  font-weight: 700;
}

.manage-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.manage-card label { display: grid; gap: 4px; font-weight: 700; }
.manage-card label.check { display: flex; align-items: center; font-weight: 400; }
.manage-card input[type="text"],
.manage-card input[type="password"],
.manage-card input[type="number"],
.manage-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
}

.choice-table { display: grid; gap: 10px; }
.choice-row {
  display: grid;
  grid-template-columns: 1fr 7rem auto auto;
  gap: 10px;
  align-items: end;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.manage-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}
.manage-actions button { width: auto; }
.manage-actions a,
.sheet a { color: var(--accent); }

button.danger { background: var(--danger); }
.survey-row { display: flex; gap: 8px; align-items: stretch; }
.survey-row > a:first-child { flex: 1; }
.text-button {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-decoration: none;
  color: var(--danger);
  font-weight: 700;
}
a.text-button.open { color: var(--accent); }

.token-sort {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: 700;
  line-height: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.token-sort::after {
  content: '↕';
  margin-left: 4px;
  font-size: 0.72rem;
  opacity: 0.45;
}
.token-sort.is-asc::after { content: '↑'; opacity: 1; }
.token-sort.is-desc::after { content: '↓'; opacity: 1; }
.token-sheet { width: calc(100% - 24px); }
.token-table-wrap {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.token-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.col-id { width: 13%; }
.col-name { width: 15%; }
.col-pref { width: 7%; }
.col-city { width: 8%; }
.col-memo { width: 7%; }
.col-status { width: 5%; }
.col-count { width: 4%; }
.col-url { width: 15%; }
.col-actions { width: 26%; }
.token-table th,
.token-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.token-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.token-table th:last-child { text-align: right; }
.token-table tr:last-child td { border-bottom: 0; }
.token-row.inactive td { color: var(--muted); }
.token-url {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.82rem;
}
.token-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.token-actions form { display: flex; margin: 0; }
.token-actions button,
.token-actions a {
  width: auto;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}
.token-actions a {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.token-picker { margin-top: 4px; }
.token-picker summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.token-picker .manage-card { margin-top: 10px; }
.facility-picker { display: grid; gap: 12px; }

.manage-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
  background: #fff;
}

.messages { list-style: none; padding: 0; }
.messages .success { color: var(--accent); font-weight: 700; }
.messages .error { color: var(--danger); font-weight: 700; }

.eyebrow a { color: var(--accent); text-decoration: none; }

.condition-row {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.condition-choices { display: grid; gap: 6px; }
.condition-choices[hidden] { display: none; }
.condition-row button.quiet { justify-self: start; }

@media (max-width: 720px) {
  .choice-row { grid-template-columns: 1fr; }
}
