:root {
  --shell-max-width: 1120px;
}

.page-shell {
  min-height: 100vh;
  padding: 2rem 1rem 3rem;
  padding-top: 0.75rem;
}

.page-frame {
  position: relative;
  max-width: var(--shell-max-width);
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.2rem 0 0.4rem;
  margin-bottom: 0.5rem;
}

.page-brand {
  display: inline-flex;
  align-items: center;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent-strong, inherit);
  text-decoration: none;
}

.page-brand:hover,
.page-brand:focus-visible {
  text-decoration: underline;
}

.content-shell {
  max-width: none;
  margin: 0;
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(26, 31, 46, 0.06);
}

.theme-picker__label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

.theme-picker__select {
  min-width: 6.75rem;
  max-width: 8rem;
  padding: 0.28rem 0.45rem;
  font-size: 0.78rem;
}

.run-button,
.copy-button,
.clear-cache-button,
.global-job-notice__close {
  white-space: nowrap;
  flex-shrink: 0;
}

.run-button:disabled,
.run-button[aria-disabled="true"],
.clear-cache-button:disabled,
.clear-cache-button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.35);
  box-shadow: none;
  pointer-events: none;
}

.run-button:disabled:hover,
.run-button[aria-disabled="true"]:hover,
.clear-cache-button:disabled:hover,
.clear-cache-button[aria-disabled="true"]:hover {
  background: inherit;
  color: inherit;
  border-color: inherit;
}

.global-job-notice {
  position: sticky;
  top: 0.75rem;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 auto 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(26, 31, 46, 0.1);
}

.global-job-notice__text {
  margin: 0;
}

.global-job-notice__close {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.hub-lede {
  margin: 1rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.hub-group {
  margin-top: 1.5rem;
}

.hub-group__title {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.hub-card:hover,
.hub-card:focus-visible {
  border-color: var(--accent-strong, var(--line));
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(26, 31, 46, 0.08);
}

.hub-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.hub-card__description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}

.chatgpt-page-toolbar {
  align-items: stretch;
  justify-content: flex-end;
}

.chatgpt-layout-picker {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.chatgpt-layout-picker__label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.chatgpt-layout-picker__segments {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel, transparent);
}

.chatgpt-layout-segment {
  appearance: none;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  background: transparent;
  color: var(--ink, inherit);
  cursor: pointer;
  line-height: 1.1;
}

.chatgpt-layout-segment:first-child {
  border-left: 0;
}

.chatgpt-layout-segment:hover,
.chatgpt-layout-segment:focus-visible {
  background: rgba(43, 108, 176, 0.08);
}

.chatgpt-layout-picker .chatgpt-layout-segment.is-active {
  background: rgba(43, 108, 176, 0.15);
  color: var(--accent-strong, var(--accent));
  font-weight: 600;
}

.card-picker__rows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card-picker__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
}

.card-picker__row .card-picker__input-shell {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.card-picker__row .card-picker__input {
  display: block;
  width: 100%;
  min-width: 0;
}

.card-picker__add,
.card-picker__remove {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft-bg);
  color: var(--ink);
  cursor: pointer;
}

.card-picker__add:hover,
.card-picker__remove:hover {
  background: var(--warning);
}

.card-picker__add[hidden],
.card-picker__add.hidden {
  display: none;
}

.card-picker__row .card-picker__remove[hidden],
.card-picker__row .card-picker__remove.hidden {
  display: inline-flex !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.card-picker__add svg,
.card-picker__remove svg {
  display: block;
}

.sync-column__hint--block {
  display: block;
  margin-top: 0.2rem;
}

.nested-panel--compact {
  margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
  .theme-picker__select {
    min-width: 0;
    max-width: 9rem;
  }
}

/* Primary nav (Help link in header) */
.page-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    margin-right: 1rem;
}
.page-nav__link {
    text-decoration: none;
    font-weight: 600;
    color: inherit;
}
.page-nav__link:hover,
.page-nav__link:focus {
    text-decoration: underline;
}

/* Footer */
.page-footer {
    margin-top: 2rem;
    padding: 1rem 0;
    border-top: 1px solid currentColor;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    text-align: right;
    font-size: 0.9rem;
}
.page-footer__link {
    color: inherit;
    text-decoration: none;
    padding: 0.35rem 0.25rem;
}
.page-footer__link:hover,
.page-footer__link:focus {
    text-decoration: underline;
}
.page-footer__link--cta {
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--accent-strong);
    border-radius: 999px;
    color: var(--accent-strong);
    background: transparent;
    transition: background 120ms ease, color 120ms ease;
}
.page-footer__link--cta:hover,
.page-footer__link--cta:focus {
    background: var(--accent-strong);
    color: var(--ink-on-accent, var(--panel));
    text-decoration: none;
}
/* Reserve right-edge space for the fixed back-to-top button at narrow widths */
@media (max-width: 1152px) {
    .page-footer {
        padding-right: 5rem;
    }
}

/* About page — themed panel */
.about-page {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    padding: 1.5rem 1.75rem;
    color: var(--ink, inherit);
}
.about-page h1 {
    color: var(--accent-strong, var(--accent, inherit));
    margin-top: 0;
}
.about-page h2 {
    margin-top: 1.5rem;
}
.about-page__tagline {
    max-width: 60ch;
    line-height: 1.5;
    color: var(--muted, inherit);
}
.about-page__meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 1.25rem 0;
}
.about-page__meta dt {
    font-weight: 600;
    color: var(--muted, inherit);
}
.about-page__meta dd {
    margin: 0;
}
.about-page__credits {
    padding-left: 1.25rem;
    line-height: 1.6;
}
.about-page a {
    color: var(--accent-strong, var(--accent));
    text-decoration: none;
}
.about-page a:hover,
.about-page a:focus-visible {
    text-decoration: underline;
}

/* Help index — themed panel */
.help-index {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    padding: 1.5rem 1.75rem;
    color: var(--ink, inherit);
}
.help-index h1 {
    color: var(--accent-strong, var(--accent, inherit));
    margin-top: 0;
}
.help-index__list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
    display: grid;
    gap: 0.75rem;
}
.help-index__item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.help-index__link {
    font-weight: 600;
    color: var(--accent-strong, var(--accent));
    text-decoration: none;
}
.help-index__link:hover,
.help-index__link:focus-visible {
    text-decoration: underline;
}
.help-index__summary {
    color: var(--muted, inherit);
}

/* Help topic — themed panel */
.help-breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--muted, inherit);
}
.help-breadcrumb a {
    color: var(--accent-strong, var(--accent));
    text-decoration: none;
}
.help-breadcrumb a:hover,
.help-breadcrumb a:focus-visible {
    text-decoration: underline;
}
.help-prose {
    max-width: 72ch;
    line-height: 1.6;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    padding: 1.5rem 1.75rem;
    color: var(--ink, inherit);
}
.help-prose h1 {
    color: var(--accent-strong, var(--accent, inherit));
    margin-top: 0;
}
.help-prose h2,
.help-prose h3 {
    margin-top: 1.5em;
}
.help-prose a {
    color: var(--accent-strong, var(--accent));
    text-decoration: none;
}
.help-prose a:hover,
.help-prose a:focus-visible {
    text-decoration: underline;
}
.help-prose pre {
    overflow-x: auto;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: var(--panel-soft-bg, rgba(0, 0, 0, 0.08));
    color: inherit;
}
.help-prose code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95em;
}
.help-prose :not(pre) > code {
    padding: 0.1em 0.35em;
    border-radius: 3px;
    background: var(--panel-soft-bg, rgba(0, 0, 0, 0.08));
}
.help-prose table {
    border-collapse: collapse;
    margin: 1em 0;
}
.help-prose th,
.help-prose td {
    border: 1px solid var(--line);
    padding: 0.35rem 0.6rem;
    vertical-align: top;
}
.help-prose th {
    background: var(--panel-soft-bg, transparent);
}
/* Feedback page */
.feedback-page { max-width: 720px; margin: 2rem auto; padding: 0 1rem; }
.feedback-panel { padding: 1.5rem; border-radius: 8px; }
.feedback-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.feedback-field { display: flex; flex-direction: column; gap: 0.25rem; }
.feedback-field label { font-weight: 600; }
.feedback-field input, .feedback-field select, .feedback-field textarea {
    background: var(--panel);
    color: var(--ink, inherit);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.5rem;
    font: inherit;
}
.feedback-submit {
    align-self: flex-start;
    background: var(--accent-strong, #3a7);
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.feedback-submit:hover { filter: brightness(1.1); }
.feedback-error { color: var(--accent-strong, #c55); font-size: 0.875rem; }
.feedback-banner { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.feedback-banner--success { background: rgba(76, 175, 80, 0.15); border: 1px solid rgba(76, 175, 80, 0.4); }
.feedback-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Admin feedback */
.admin-feedback { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.admin-feedback-filters { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-feedback-filter {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    text-decoration: none;
    color: var(--accent-strong, inherit);
}
.admin-feedback-filter.active { background: var(--accent-strong); color: #fff; }
.admin-feedback-table { width: 100%; border-collapse: collapse; }
.admin-feedback-table th, .admin-feedback-table td { padding: 0.5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-feedback-pagination { margin-top: 1rem; display: flex; gap: 0.75rem; align-items: center; }
.admin-feedback-empty { margin: 2rem 0; font-style: italic; }
.type-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.8rem; background: var(--panel); border: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
.detail-grid dt { font-weight: 600; }
.detail-message { white-space: pre-wrap; word-wrap: break-word; background: rgba(0,0,0,0.05); padding: 1rem; border-radius: 4px; }
.detail-actions { margin-top: 1.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.detail-actions button.danger { background: #c33; color: #fff; border: none; padding: 0.4rem 0.8rem; border-radius: 4px; cursor: pointer; }
