:root {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #f5f7ff;
  background: #080d1b;
  line-height: 1.5;
  --bg: #080d1b;
  --panel: #121b31;
  --panel-2: #17223c;
  --line: #273553;
  --line-bright: #3a4d76;
  --text: #f5f7ff;
  --muted: #9ba8c7;
  --accent: #7d75ff;
  --accent-2: #5f8cff;
  --green: #4ed4a3;
  --yellow: #f5c96a;
  --red: #ff748a;
  --blue: #71a7ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% -10%, rgba(65, 93, 170, .28), transparent 34%),
    radial-gradient(circle at 100% 10%, rgba(106, 73, 187, .18), transparent 28%),
    var(--bg);
}

a { color: #a9bcff; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

main {
  width: min(1580px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 76px;
}

.topbar {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(8, 13, 27, .88);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar nav { display: flex; gap: 20px; align-items: center; }
.brand { font-weight: 850; color: white; letter-spacing: -.02em; }
.muted, .hint, .field-note { color: var(--muted); }
.inline { display: inline; }
.link-button { background: none; border: 0; color: #a9bcff; font: inherit; cursor: pointer; }

footer {
  text-align: center;
  color: var(--muted);
  padding: 25px;
  border-top: 1px solid var(--line);
}

.eyebrow {
  letter-spacing: .18em;
  font-size: 12px;
  color: #93aaff;
  font-weight: 800;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 8px 0 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -.04em;
}

.page-head p { margin: 10px 0 0; }
.portal-page-head { margin-bottom: 20px; }
.back-link { display: inline-flex; margin-bottom: 18px; font-weight: 750; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #405077;
  background: #202a48;
  color: white;
  border-radius: 11px;
  padding: 11px 17px;
  cursor: pointer;
  font-weight: 700;
}

.button.primary {
  background: linear-gradient(135deg, #667eea, #8b6cff);
  border-color: transparent;
  box-shadow: 0 14px 34px rgba(102, 102, 255, .22);
}

.button.danger { border-color: #7f3549; color: #ffc1cb; }
.button:disabled { opacity: .55; cursor: not-allowed; }

.hero {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 42px;
  align-items: center;
  padding: 72px 0;
}

.hero h1 { font-size: clamp(38px, 6vw, 72px); line-height: 1.03; margin: 12px 0 22px; }
.hero-card, .panel, .auth-card, .plan, .empty {
  background: linear-gradient(145deg, rgba(28, 38, 68, .95), rgba(17, 23, 42, .95));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.metric { padding: 18px 0; border-bottom: 1px solid var(--line); }
.metric:last-child { border: 0; }
.metric b, .metric span { display: block; }
.metric b { font-size: 24px; }
.metric span { color: var(--muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.features, .grid, .plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.features article { padding: 22px; border-top: 1px solid var(--line); }
.auth-card { max-width: 480px; margin: 40px auto; }
.auth-card form, .panel form { display: grid; gap: 14px; }
.auth-card label, .panel label { display: grid; gap: 7px; color: #d8def0; }

input, select, textarea {
  width: 100%;
  border: 1px solid #344260;
  background: #0e1528;
  color: white;
  border-radius: 10px;
  padding: 11px 12px;
}

textarea { resize: vertical; }
.price { font-size: 30px; font-weight: 800; }

.subscription-summary {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(27, 39, 69, .96), rgba(15, 23, 42, .96));
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(180px, .8fr));
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.subscription-plan-block,
.subscription-metric-block { display: grid; gap: 4px; }
.subscription-plan-block strong,
.subscription-metric-block strong { font-size: 18px; }
.subscription-metric-block { border-left: 1px solid var(--line); padding-left: 18px; }
.metric-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.metric-help { color: var(--muted); font-size: 12px; }
.usage-bar { height: 7px; border-radius: 99px; overflow: hidden; background: rgba(7, 12, 24, .72); margin-top: 5px; }
.usage-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); border-radius: inherit; }

.portal-table-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(19, 29, 52, .97), rgba(12, 19, 35, .97));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }
.portal-table { width: 100%; border-collapse: collapse; }
.accounts-table { min-width: 920px; }
.tasks-table { min-width: 900px; }
.portal-table th, .portal-table td { padding: 15px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.portal-table th {
  background: rgba(8, 13, 27, .50);
  color: #cbd5ef;
  text-align: left;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 800;
  white-space: nowrap;
}
.portal-table tbody tr:last-child td { border-bottom: 0; }
.account-table-row { cursor: pointer; transition: background .16s ease, box-shadow .16s ease; }
.account-table-row:hover { background: rgba(111, 129, 204, .10); box-shadow: inset 4px 0 0 var(--accent-2); }
.number-cell { width: 58px; text-align: center; color: var(--muted); font-weight: 800; }

.table-input {
  width: 100%;
  border: 1px solid transparent;
  background: rgba(7, 12, 24, .48);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 11px;
  outline: none;
}
.table-input:focus { border-color: var(--accent-2); background: rgba(8, 14, 29, .9); }
.account-name-input { min-width: 165px; }
.email-input { min-width: 230px; }
.email-input:disabled { color: #afbddb; cursor: not-allowed; background: rgba(28, 37, 60, .72); border-color: rgba(58, 77, 118, .55); }
.email-cell { min-width: 240px; }
.field-note { font-size: 11px; margin-top: 5px; }

.account-status { display: inline-flex; align-items: center; gap: 8px; min-width: 195px; font-size: 13px; font-weight: 700; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: #6f7d9d; }
.account-status.stopped { color: #aab5d0; }
.account-status.online { color: var(--green); }
.account-status.online .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(78, 212, 163, .11); }
.account-status.running { color: var(--blue); }
.account-status.running .status-dot { background: var(--blue); box-shadow: 0 0 0 4px rgba(113, 167, 255, .11); }
.account-status.waiting { color: var(--yellow); }
.account-status.waiting .status-dot { background: var(--yellow); box-shadow: 0 0 0 4px rgba(245, 201, 106, .11); }
.row-error { color: #ffabb9; font-size: 11px; margin-top: 5px; }

.player-trigger {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 1px solid var(--line-bright);
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(27, 38, 67, .95);
}
.player-trigger.play { background: rgba(45, 114, 92, .22); border-color: rgba(78, 212, 163, .48); color: #74e4bb; }
.player-trigger.stop { background: rgba(124, 44, 61, .20); border-color: rgba(255, 116, 138, .48); color: #ff9bad; }
.play-icon { width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 12px solid currentColor; margin-left: 3px; }
.stop-icon { width: 13px; height: 13px; border-radius: 2px; background: currentColor; }

.table-summary { padding: 17px 20px; border-top: 1px solid var(--line); display: flex; gap: 24px; flex-wrap: wrap; color: var(--muted); font-size: 13px; background: rgba(8, 13, 27, .34); }
.table-summary b { color: var(--text); }
.empty-table { text-align: center; padding: 30px 18px; color: var(--muted); }
.account-detail-table { margin-bottom: 26px; }
.task-section-head { margin: 26px 0 14px; }
.task-section-head h2 { margin: 5px 0 0; }

.task-table-row { transition: background .16s ease, box-shadow .16s ease; }
.task-table-row:hover { background: rgba(111, 129, 204, .06); }
.task-table-row.enabled { background: rgba(52, 122, 91, .18); box-shadow: inset 4px 0 0 var(--green); }
.task-table-row.enabled:hover { background: rgba(52, 122, 91, .25); }
.task-check { width: 18px; height: 18px; accent-color: var(--green); }
.task-id-button {
  min-width: 68px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid rgba(125, 117, 255, .55);
  color: #cdd4ff;
  background: rgba(91, 94, 199, .18);
  font-weight: 850;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.task-id-button:hover { background: rgba(91, 94, 199, .30); border-color: var(--accent); }
.task-name-main { font-weight: 850; line-height: 1.25; margin-bottom: 5px; }
.task-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.task-state-dot { width: 7px; height: 7px; border-radius: 50%; background: #6f7d9d; }
.task-state.active { color: var(--green); }
.task-state.active .task-state-dot { background: var(--green); }
.pause-editor {
  width: 126px;
  border: 1px solid var(--line-bright);
  background: rgba(16, 24, 45, .72);
  color: #d8e0f6;
  border-radius: 10px;
  padding: 9px 11px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 850;
}
.timer-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(78, 212, 163, .34);
  background: rgba(40, 114, 88, .16);
  color: #9ce9cc;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 850;
  cursor: pointer;
}
.timer-chip:hover:not(:disabled) { border-color: rgba(78, 212, 163, .72); background: rgba(40, 114, 88, .28); }
.timer-chip:disabled { cursor: not-allowed; }
.timer-chip.off { border-color: var(--line); background: rgba(16, 24, 45, .55); color: #7784a3; }
.timer-reset-form,
.timer-reset-all-form { margin: 0; }
.timer-column-head { display: inline-flex; align-items: center; gap: 8px; }
.timer-reset-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: rgba(16, 24, 45, .72);
  color: #b8c4df;
  cursor: pointer;
}
.timer-reset-all:hover:not(:disabled) { color: #fff; border-color: var(--accent); background: rgba(91, 94, 199, .24); }
.timer-reset-all:disabled { cursor: not-allowed; opacity: .55; }
.timer-reset-all svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.alert { border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.alert.error { background: #3c1c2a; color: #ffc0ca; }
.alert.success { background: #143a30; color: #a7f3d6; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 7, 16, .76);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.portal-modal {
  width: min(680px, 100%);
  max-height: min(91vh, 880px);
  overflow: auto;
  background: linear-gradient(145deg, #16213b, #10182d);
  border: 1px solid var(--line-bright);
  border-radius: 22px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .55);
  padding: 26px;
}
.wide-modal { width: min(920px, 100%); }
.compact-modal { width: min(560px, 100%); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.modal-head h2, .portal-modal h2 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.modal-head p, .portal-modal > p { color: var(--muted); }
.modal-close { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 13, 27, .5); color: var(--muted); font-size: 22px; }
.modal-form, .task-settings-form { display: grid; gap: 15px; }
.modal-form label, .settings-grid label { display: grid; gap: 7px; color: #dbe2f6; font-size: 13px; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.limit-icon { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: rgba(255, 116, 138, .15); border: 1px solid rgba(255, 116, 138, .35); color: #ff9cae; font-size: 28px; font-weight: 900; margin-bottom: 14px; }
.otp-input { font-size: 24px; letter-spacing: .2em; text-align: center; font-weight: 850; }

.task-settings-id { display: inline-flex; margin-top: 8px; padding: 7px 11px; border-radius: 9px; border: 1px solid rgba(125, 117, 255, .48); background: rgba(91, 94, 199, .17); color: #d9ddff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 850; }
.settings-section { border: 1px solid var(--line); border-radius: 15px; padding: 16px; background: rgba(8, 13, 27, .30); }
.settings-section h3 { margin: 0 0 13px; font-size: 15px; color: #dce4fb; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.full-width { grid-column: 1 / -1; }
.checkbox-line { display: flex !important; align-items: center; gap: 10px !important; }
.checkbox-line input { width: 18px; height: 18px; accent-color: var(--accent); }

.schedule-summary-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(8, 13, 27, .38);
  color: var(--text);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-weight: 800;
  text-align: left;
}
.schedule-summary-main { display: grid; gap: 3px; }
.schedule-summary-caption { color: var(--muted); font-size: 12px; font-weight: 600; }
.schedule-chevron { color: #b9c5e8; font-size: 18px; transition: transform .18s ease; }
.schedule-summary-button.expanded .schedule-chevron { transform: rotate(180deg); }
.schedule-editor { display: none; margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: rgba(8, 13, 27, .28); }
.schedule-editor.open { display: block; }
.schedule-policy-help { border-left: 3px solid var(--accent-2); border-radius: 0 10px 10px 0; padding: 10px 12px; background: rgba(73, 91, 161, .10); color: #c7d2ef; font-size: 12px; line-height: 1.5; }
.schedule-days { display: grid; gap: 10px; margin-top: 15px; }
.schedule-day { border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: rgba(12, 20, 37, .62); }
.schedule-day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.schedule-day-name { font-weight: 850; min-width: 95px; }
.schedule-day-empty { color: var(--muted); font-size: 12px; line-height: 1.4; }
.schedule-intervals { display: grid; gap: 8px; }
.schedule-interval { display: grid; grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr) auto; gap: 8px; align-items: center; }
.schedule-interval-separator { color: var(--muted); font-size: 12px; text-align: center; }
.schedule-add-button, .schedule-remove-button { border-radius: 9px; border: 1px solid var(--line-bright); background: rgba(24, 35, 62, .82); color: #dbe3f8; padding: 8px 10px; font-weight: 750; white-space: nowrap; }
.schedule-remove-button { border-color: rgba(255, 116, 138, .32); color: #ffadbb; background: rgba(120, 39, 57, .17); }
.apply-schedule-all { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 980px) {
  .subscription-summary { grid-template-columns: 1fr 1fr; }
  .subscription-metric-block:last-child { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); padding: 13px 0 0; }
}

@media (max-width: 800px) {
  main { width: min(100% - 24px, 1580px); padding-top: 28px; }
  .hero { grid-template-columns: 1fr; padding: 30px 0; }
  .features, .grid, .plans { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; flex-direction: column; }
  .topbar nav a { display: none; }
  .subscription-summary, .settings-grid { grid-template-columns: 1fr; }
  .subscription-metric-block { border-left: 0; border-top: 1px solid var(--line); padding: 13px 0 0; }
}

@media (max-width: 620px) {
  .schedule-interval { grid-template-columns: 1fr; }
  .schedule-interval-separator { display: none; }
  .modal-actions .button { width: 100%; }
}

/* Character-bound subaccounts (v2.4). */
.character-accounts-table { min-width: 1040px; }
.character-name { font-weight: 900; font-size: 15px; color: #eef3ff; }
.character-name.pending { color: var(--yellow); }
.character-change-link {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9eb5ff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.character-change-link:hover { color: #d4deff; }
.character-summary { min-width: 210px; color: #c8d2eb; font-size: 12px; line-height: 1.55; white-space: pre-line; }
.waiting-trigger { color: var(--yellow); text-decoration: none; font-size: 18px; font-weight: 900; }
.catalog-wait {
  margin: -10px 0 24px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 201, 106, .35);
  border-radius: 12px;
  background: rgba(126, 93, 30, .16);
  color: #f6d68c;
  font-weight: 750;
}
.character-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.character-card {
  display: grid;
  gap: 8px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(7, 13, 27, .45);
}
.character-card strong { font-size: 18px; color: #f0f4ff; }
.character-card > span { color: #c5d0e9; font-size: 13px; }
.character-card.selected { border-color: rgba(78, 212, 163, .55); box-shadow: inset 0 0 0 1px rgba(78, 212, 163, .14); }
.character-card .button { margin-top: 8px; width: 100%; }

@media (max-width: 620px) {
  .character-grid { grid-template-columns: 1fr; }
}

/* Fresh-auth confirmation and safe subaccount deletion (v2.5.1). */
.actions-cell { width: 74px; text-align: center; }
.icon-action {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(15, 24, 44, .74);
  color: #cbd6f2;
  font-size: 22px;
  line-height: 1;
  font-weight: 850;
}
.icon-action.danger { border-color: rgba(255, 116, 138, .40); color: #ff9cae; background: rgba(120, 39, 57, .15); }
.icon-action.danger:hover { border-color: rgba(255, 116, 138, .72); background: rgba(120, 39, 57, .28); }
.danger-button { border-color: rgba(255, 116, 138, .58); background: linear-gradient(135deg, #d94f6c, #a93b55); color: #fff; }
.delete-account-summary { display: grid; gap: 5px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(8, 13, 27, .38); }
.delete-account-summary strong { color: #f2f5ff; font-size: 17px; }
.delete-account-summary span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.auth-progress-indicator { display: flex; justify-content: center; gap: 8px; padding: 18px 0 8px; }
.auth-progress-indicator span { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); animation: auth-pulse 1.1s infinite ease-in-out; }
.auth-progress-indicator span:nth-child(2) { animation-delay: .14s; }
.auth-progress-indicator span:nth-child(3) { animation-delay: .28s; }
.auth-progress-indicator.failed { display: none; }
.auth-progress-error { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(255, 116, 138, .38); border-radius: 12px; background: rgba(120, 39, 57, .16); color: #ffc1cc; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.auth-retry-form[hidden], .auth-progress-error[hidden] { display: none; }
.resend-code-form { margin-top: 12px; text-align: center; }
@keyframes auth-pulse { 0%, 80%, 100% { opacity: .28; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.provisioning-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 31, 58, .72);
}
.provisioning-card > div { display: grid; gap: 8px; }
.provisioning-card strong { color: #f3f6ff; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .provisioning-card { align-items: stretch; flex-direction: column; }
}

/* Character selection and task edit safety (v2.6.4). */
.character-table-modal { max-width: 980px; }
.character-list-scroll {
  max-height: min(58vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(7, 13, 27, .42);
}
.character-picker-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}
.character-picker-table th,
.character-picker-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.character-picker-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #121d37;
  color: #aebee3;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.character-picker-table tbody tr:last-child td { border-bottom: 0; }
.character-picker-table tbody tr.selected { background: rgba(78, 212, 163, .08); }
.character-table-name { color: #f1f5ff; font-size: 16px; font-weight: 850; }
.character-login-cell { width: 150px; }
.character-login-cell form { margin: 0; }
.character-login-button { min-width: 120px; }

.button-loader,
.inline-loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.32);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: kg-spin .72s linear infinite;
}
.button.is-loading { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.button.is-loading .button-loader { display: inline-block; }
.inline-loader { display: inline-block; flex: 0 0 auto; color: #f6d68c; border-color: rgba(246,214,140,.3); border-top-color: currentColor; }
@keyframes kg-spin { to { transform: rotate(360deg); } }

.task-edit-lock {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: -6px 0 16px;
  padding: 13px 15px;
  border: 1px solid rgba(245, 201, 106, .38);
  border-radius: 13px;
  background: rgba(126, 93, 30, .16);
  color: #f6d68c;
  font-weight: 760;
}
.task-editing-locked { position: relative; opacity: .72; }
.task-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
  background: rgba(8, 13, 27, .08);
  cursor: not-allowed;
}
.task-lock-overlay:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.task-editing-locked input:disabled,
.task-editing-locked button:disabled,
.task-settings-fieldset:disabled { cursor: not-allowed; }
.task-settings-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.task-settings-fieldset:disabled { opacity: .62; }

@media (max-width: 720px) {
  .character-table-modal { width: calc(100vw - 24px); }
  .character-list-scroll { max-height: 64vh; }
}
.player-trigger.is-loading .play-icon,
.player-trigger.is-loading .stop-icon { display: none; }
.player-trigger.is-loading .button-loader { display: inline-block; }

.admin-hero-layout { display:grid; grid-template-columns:repeat(auto-fit,minmax(360px,1fr)); gap:18px; margin-bottom:18px; }
.admin-hero-editor { min-width:0; }
.admin-hero-editor textarea { width:100%; resize:vertical; }
.hero-admin-grid,.hero-task-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; }
.hero-task-grid { margin-top:14px; max-height:420px; overflow:auto; padding:2px; }
.hero-choice-card { display:flex; align-items:center; gap:11px; min-width:0; padding:10px; border:1px solid var(--line); border-radius:13px; background:rgba(18,29,55,.68); cursor:pointer; }
.hero-choice-card:has(input:checked) { border-color:rgba(78,212,163,.72); background:rgba(36,112,91,.22); box-shadow:0 0 0 1px rgba(78,212,163,.14) inset; }
.hero-choice-card.inactive { opacity:.55; }
.hero-choice-card input { flex:0 0 auto; }
.hero-choice-visual,.hero-catalog-image { display:flex; align-items:center; justify-content:center; flex:0 0 58px; width:58px; height:58px; overflow:hidden; border-radius:12px; background:#0b1428; border:1px solid var(--line); }
.hero-choice-visual img,.hero-catalog-image img { width:100%; height:100%; object-fit:cover; }
.hero-placeholder { font-size:12px; color:var(--muted); font-weight:800; }
.hero-choice-copy { min-width:0; display:flex; flex-direction:column; gap:4px; }
.hero-choice-copy strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hero-choice-copy small { color:var(--muted); line-height:1.35; }
.hero-catalog-card { display:flex; gap:12px; align-items:center; padding:12px; border:1px solid var(--line); border-radius:14px; background:rgba(18,29,55,.55); }
.hero-tags { display:flex; gap:6px; flex-wrap:wrap; margin-top:5px; }
.hero-tags span { padding:2px 7px; border-radius:999px; background:rgba(99,131,205,.2); color:#b8c9f0; font-size:11px; }
.hero-list-details,.hero-selection-section { border:1px solid var(--line); border-radius:14px; background:rgba(12,20,39,.55); margin-top:14px; }
.hero-list-details > summary,.hero-selection-section > summary { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:14px 16px; cursor:pointer; list-style:none; }
.hero-list-details > summary::-webkit-details-marker,.hero-selection-section > summary::-webkit-details-marker { display:none; }
.hero-selection-section > summary span:first-child { display:flex; flex-direction:column; gap:3px; }
.hero-selection-section > summary small { color:var(--muted); font-weight:500; }
.hero-selection-body,.hero-list-details[open] > :not(summary) { padding:0 16px 16px; }

.hero-selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
  margin: .25rem 0 .75rem;
}
.button.compact {
  min-height: 2.15rem;
  padding: .38rem .72rem;
}

.session-start-controls{display:flex;align-items:center;gap:.65rem;flex-wrap:wrap}.session-log-toggle{display:inline-flex;align-items:center;gap:.4rem;font-size:.82rem;white-space:nowrap;cursor:pointer}.session-log-toggle input{width:1rem;height:1rem}.session-log-link-row{display:flex;align-items:center;gap:.45rem;margin-top:.45rem;font-size:.78rem;white-space:nowrap}.session-log-download{font-weight:700}.session-log-link-row span{color:var(--muted,#7b8494)}.registration-closed-note{margin-top:.9rem}
.session-log-link-row{white-space:normal;max-width:32rem}.session-log-delete-form{display:inline-flex;margin:0}.session-log-delete{display:inline-flex;align-items:center;justify-content:center;width:1.2rem;height:1.2rem;padding:0;border:0;border-radius:50%;background:transparent;color:var(--danger,#c93b45);font-size:1.05rem;line-height:1;cursor:pointer}.session-log-delete:hover,.session-log-delete:focus-visible{background:rgba(201,59,69,.12);outline:none}.session-log-download{overflow-wrap:anywhere}

/* v2.8 universal hero catalog and reusable-list editor */
.panel-head-inline { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; flex-wrap:wrap; }
.panel-head-inline h2 { margin-bottom:.25rem; }
.hero-catalog-table-panel { min-width:0; }
.hero-catalog-table-scroll { overflow:auto; max-height:68vh; border:1px solid var(--line); border-radius:14px; }
.hero-catalog-table { width:100%; min-width:1020px; border-collapse:separate; border-spacing:0; }
.hero-catalog-table th,
.hero-catalog-table td { padding:.7rem .75rem; border-bottom:1px solid var(--line); vertical-align:middle; text-align:left; }
.hero-catalog-table th { position:sticky; top:0; z-index:2; background:#101a31; color:#c9d5ef; font-size:.78rem; letter-spacing:.02em; }
.hero-catalog-table tbody tr:last-child td { border-bottom:0; }
.hero-catalog-table tbody tr:hover { background:rgba(99,131,205,.08); }
.hero-catalog-table input[type="text"],
.hero-catalog-table input:not([type]) { min-width:210px; }
.hero-table-image { width:64px; height:64px; }
.hero-element-code { display:inline-flex; min-width:2rem; justify-content:center; padding:.22rem .48rem; border-radius:999px; background:rgba(99,131,205,.18); font-weight:800; }
.hero-bonus-list { display:flex; flex-wrap:wrap; gap:.35rem; max-width:34rem; }
.hero-bonus-chip { display:inline-flex; padding:.22rem .5rem; border-radius:999px; background:rgba(78,212,163,.13); border:1px solid rgba(78,212,163,.28); color:#bcebd9; font-size:.75rem; line-height:1.2; }
.hero-list-delete-form { margin-top:.8rem; }
.button.danger { background:rgba(201,59,69,.16); border-color:rgba(201,59,69,.55); color:#ffb2b8; }
.button.danger:disabled { opacity:.45; cursor:not-allowed; }
.hero-template-editor-details { margin-top:18px; }
.hero-template-editor-details > summary { display:flex; justify-content:space-between; gap:1rem; align-items:center; cursor:pointer; list-style:none; }
.hero-template-editor-details > summary::-webkit-details-marker { display:none; }
.hero-template-editor-form { margin-top:1rem; }
.hero-template-editor-form textarea[spellcheck="false"] { font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-size:.8rem; }
.hero-choice-copy small + small { color:#b8c9f0; }
@media (max-width:720px) {
  .admin-hero-layout { grid-template-columns:1fr; }
  .hero-catalog-table-scroll { max-height:72vh; }
}


/* v2.9 administrator-owned hero policy */
.admin-hero-task-policies { margin-bottom:18px; }
.hero-policy-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(310px,1fr)); gap:14px; }
.hero-policy-card { padding:14px; border:1px solid var(--line); border-radius:14px; background:rgba(18,29,55,.55); }
.hero-catalog-table tbody tr:has(input[name="member_template_ids"]:checked) { background:rgba(36,112,91,.18); }


/* v2.9.1 list-centric task bindings and compact task hero picker */
.hero-policy-table-scroll {
  overflow: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.hero-policy-table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
}
.hero-policy-table th,
.hero-policy-table td {
  padding: .78rem .85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}
.hero-policy-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #101a31;
  color: #c9d5ef;
  font-size: .78rem;
}
.hero-policy-table tbody tr:last-child td { border-bottom: 0; }
.hero-policy-table tbody tr:hover { background: rgba(99,131,205,.08); }
.hero-policy-table th:first-child,
.hero-policy-table td:first-child { width: 108px; text-align: center; }
.hero-policy-table th:nth-child(2),
.hero-policy-table td:nth-child(2) { width: 180px; }
.hero-policy-table input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
}
.hero-policy-table select { min-width: 145px; }
.hero-policy-table tr:has(input[data-hero-policy-enabled]:checked) {
  background: rgba(36,112,91,.18);
}
.hero-policy-table tr:has(input[data-hero-policy-enabled]:disabled) { opacity: .58; }
.hero-policy-table-actions { margin-top: 14px; }

.task-hero-selection-body { padding-top: 2px; }
.task-hero-master-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.task-hero-toggle-all {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  width: auto;
  cursor: pointer;
  font-weight: 750;
}
.task-hero-toggle-all input,
.task-hero-checkbox-line input {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}
.task-hero-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
  max-height: 52vh;
  overflow: auto;
  padding: 2px 3px 4px 2px;
}
.task-hero-choice-card {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 7px !important;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(18,29,55,.68);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .14s ease;
}
.task-hero-choice-card:hover { transform: translateY(-1px); border-color: var(--line-bright); }
.task-hero-choice-card:has(input:checked) {
  border-color: rgba(78,212,163,.72);
  background: rgba(36,112,91,.22);
  box-shadow: 0 0 0 1px rgba(78,212,163,.12) inset;
}
.task-hero-choice-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 74px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1428;
}
.task-hero-choice-visual img { width: 100%; height: 100%; object-fit: cover; }
.task-hero-checkbox-line {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 6px !important;
  width: auto;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
}
.task-hero-name {
  min-height: 2.5em;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: .75rem;
  line-height: 1.25;
  color: #cbd7ef;
}
@media (max-width: 720px) {
  .hero-policy-table { min-width: 590px; }
  .task-hero-card-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
  .task-hero-choice-visual { height: 68px; }
}
.admin-task-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px;margin:18px 0}.admin-task-grid>.panel{margin:0}.task-admin-table code,.selected-task-panel code{font-size:.78rem;overflow-wrap:anywhere}.status-badge{display:inline-block;margin-left:8px;padding:2px 7px;border:1px solid var(--border);border-radius:999px;font-size:.72rem}.muted-row{opacity:.7}.compact-list{display:grid;gap:6px}.compact-list>div{display:flex;justify-content:space-between;gap:12px;padding:8px;border-bottom:1px solid var(--border)}.checkbox-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:8px;margin:12px 0}.inline-form{display:flex;align-items:center;gap:12px;margin:10px 0}.selected-task-panel textarea{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.82rem}@media(max-width:900px){.admin-task-grid{grid-template-columns:1fr}}

.task-runtime-stats{display:flex;flex-wrap:wrap;gap:.25rem .75rem;margin-top:.35rem;font-size:.78rem;color:var(--muted,#8fa0b7)}
.task-runtime-stats strong{color:inherit}
.task-runtime-last-action{flex-basis:100%;white-space:normal}

.admin-account-list { display: grid; gap: 18px; }
.admin-user-card { padding: 20px; }
.admin-subaccount-table code,
.admin-task-control-table code { font-size: 11px; color: var(--muted); }
.admin-task-control-table input[type="checkbox"] { width: 20px; height: 20px; }
.admin-control-summary { grid-template-columns: 1.4fr .8fr .8fr; }
.status-badge.running { border-color: rgba(78, 212, 163, .5); color: var(--green); }
.status-badge.waiting { border-color: rgba(245, 201, 106, .5); color: var(--yellow); }
.status-badge.stopped { border-color: var(--line-bright); color: var(--muted); }
@media (max-width: 900px) {
  .admin-control-summary { grid-template-columns: 1fr; }
}


.portal-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.portal-control-card { margin: 0; }
.portal-settings-form { display: grid; gap: 18px; }
.portal-switch-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(18, 29, 55, .58);
  cursor: pointer;
}
.portal-switch-row input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 2px;
}
.portal-switch-row span { display: grid; gap: 5px; }
.portal-switch-row small,
.portal-settings-form label > small { color: var(--muted); line-height: 1.45; }
.portal-danger-card {
  grid-column: 1 / -1;
  border-color: rgba(255, 107, 136, .42);
}
.alert.warning {
  border-color: rgba(245, 201, 106, .5);
  background: rgba(245, 201, 106, .10);
  color: var(--yellow);
}
@media (max-width: 900px) {
  .portal-control-grid { grid-template-columns: 1fr; }
  .portal-danger-card { grid-column: auto; }
}
