/* ============================================================================
   HCS Fitness Reporter — Apple-style UI
   Photography-first design language adapted to a configuration form:
   alternating tiles, single blue accent, pill CTAs, near-invisible chrome.
   ============================================================================ */

:root {
  /* Brand & accent */
  --ap-primary: #0066cc;
  --ap-primary-focus: #0071e3;
  --ap-primary-on-dark: #2997ff;

  /* Surfaces */
  --ap-canvas: #ffffff;
  --ap-parchment: #f5f5f7;
  --ap-pearl: #fafafc;
  --ap-tile-1: #272729;
  --ap-tile-2: #2a2a2c;
  --ap-tile-3: #252527;
  --ap-black: #000000;

  /* Text */
  --ap-ink: #1d1d1f;
  --ap-on-dark: #ffffff;
  --ap-body-muted: #cccccc;
  --ap-ink-80: #333333;
  --ap-ink-48: #7a7a7a;
  --ap-ink-on-dark-muted: #a1a1a6;

  /* Borders */
  --ap-divider-soft: #f0f0f0;
  --ap-hairline: #e0e0e0;
  --ap-hairline-strong: rgba(0, 0, 0, 0.08);
  --ap-hairline-on-dark: rgba(255, 255, 255, 0.16);

  /* Radii */
  --ap-r-none: 0;
  --ap-r-xs: 5px;
  --ap-r-sm: 8px;
  --ap-r-md: 11px;
  --ap-r-lg: 18px;
  --ap-r-pill: 9999px;

  /* Spacing */
  --ap-x4: 4px;
  --ap-x8: 8px;
  --ap-x12: 12px;
  --ap-x17: 17px;
  --ap-x24: 24px;
  --ap-x32: 32px;
  --ap-x48: 48px;
  --ap-section: 80px;

  /* Single product-shadow — used only on hero illustration if present */
  --ap-product-shadow: 3px 5px 30px 0 rgba(0, 0, 0, 0.22);

  /* Type stacks */
  --ap-display: "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ap-text: "SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------------------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--ap-canvas);
  color: var(--ap-ink);
  font-family: var(--ap-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--ap-primary);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* The container is a vertical stack of edge-to-edge tiles */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

/* ---------------------------------------------------------------------------
   Global nav (slim black bar)
   --------------------------------------------------------------------------- */

.ap-global-nav {
  background: var(--ap-black);
  color: var(--ap-on-dark);
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 9000;
  font-family: var(--ap-text);
  font-size: 12px;
  letter-spacing: -0.01em;
}

.ap-global-nav .ap-gnav-left,
.ap-global-nav .ap-gnav-right {
  display: flex;
  align-items: center;
  gap: 22px;
}

.ap-global-nav a,
.ap-global-nav button {
  color: var(--ap-on-dark);
  background: transparent;
  border: none;
  padding: 0;
  font-size: 12px;
  letter-spacing: -0.01em;
  opacity: 0.88;
  text-decoration: none;
}

.ap-global-nav a:hover,
.ap-global-nav button:hover {
  opacity: 1;
  text-decoration: none;
}

.ap-gnav-brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  opacity: 1 !important;
}

.ap-gnav-brand .ap-gnav-mark {
  color: var(--ap-primary-on-dark);
}

/* ---------------------------------------------------------------------------
   Sub-nav (frosted parchment)
   --------------------------------------------------------------------------- */

.ap-sub-nav {
  position: sticky;
  top: 44px;
  z-index: 8500;
  background: rgba(245, 245, 247, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--ap-hairline-strong);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.ap-sub-nav .ap-subnav-title {
  font-family: var(--ap-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.011em;
  color: var(--ap-ink);
}

.ap-sub-nav .ap-subnav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  letter-spacing: -0.016em;
}

.ap-sub-nav .ap-subnav-actions a {
  color: var(--ap-ink);
  font-weight: 400;
}

/* ---------------------------------------------------------------------------
   Tiles — the core layout primitive
   --------------------------------------------------------------------------- */

.ap-tile {
  width: 100%;
  padding: var(--ap-section) 32px;
  border-radius: 0;
  border: 0;
  position: relative;
}

.ap-tile-light    { background: var(--ap-canvas); color: var(--ap-ink); }
.ap-tile-parch    { background: var(--ap-parchment); color: var(--ap-ink); }
.ap-tile-dark     { background: var(--ap-tile-1); color: var(--ap-on-dark); }
.ap-tile-dark-2   { background: var(--ap-tile-2); color: var(--ap-on-dark); }

.ap-tile-inner {
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

.ap-tile-narrow .ap-tile-inner { max-width: 720px; }

/* Hero tile content stack */
.ap-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.ap-hero h1 {
  font-family: var(--ap-display);
  font-size: 56px;
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.005em;
  margin: 0;
  color: var(--ap-ink);
}

.ap-hero .ap-tagline {
  font-family: var(--ap-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: 0.007em;
  color: var(--ap-ink);
  margin: 0;
  max-width: 720px;
}

.ap-hero .ap-eyebrow {
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.016em;
  color: var(--ap-primary);
  text-transform: none;
  margin: 0;
}

.ap-hero .ap-cta-row {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.ap-hero .ap-hcs-mark {
  height: 64px;
  width: auto;
  margin-bottom: 8px;
}

/* Section heads inside form tiles */
.ap-section-head {
  text-align: center;
  margin-bottom: 48px;
}

.ap-section-head h2 {
  font-family: var(--ap-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.10;
  letter-spacing: 0;
  margin: 0 0 12px 0;
  color: var(--ap-ink);
}

.ap-section-head p {
  font-family: var(--ap-display);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.33;
  letter-spacing: 0.011em;
  color: var(--ap-ink-80);
  margin: 0 auto;
  max-width: 640px;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */

.ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--ap-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.022em;
  border: 0;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.ap-btn:active { transform: scale(0.95); }
.ap-btn:focus-visible { outline: 2px solid var(--ap-primary-focus); outline-offset: 3px; }

.ap-btn-primary {
  background: var(--ap-primary);
  color: var(--ap-on-dark);
  border-radius: var(--ap-r-pill);
  padding: 11px 22px;
  min-height: 44px;
}

.ap-btn-primary:hover { background: #0077ed; color: var(--ap-on-dark); text-decoration: none; }

.ap-btn-secondary {
  background: transparent;
  color: var(--ap-primary);
  border: 1px solid var(--ap-primary);
  border-radius: var(--ap-r-pill);
  padding: 10px 21px;
  min-height: 44px;
}

.ap-btn-secondary:hover {
  background: rgba(0, 102, 204, 0.06);
  text-decoration: none;
}

.ap-btn-dark {
  background: var(--ap-ink);
  color: var(--ap-on-dark);
  border-radius: var(--ap-r-sm);
  padding: 8px 15px;
  font-size: 14px;
  letter-spacing: -0.016em;
  min-height: 32px;
}

.ap-btn-dark:hover { background: #2a2a2c; color: var(--ap-on-dark); text-decoration: none; }

.ap-btn-pearl {
  background: var(--ap-pearl);
  color: var(--ap-ink-80);
  border: 1px solid var(--ap-divider-soft);
  border-radius: var(--ap-r-md);
  padding: 8px 14px;
  font-size: 14px;
  letter-spacing: -0.016em;
  min-height: 36px;
}

.ap-btn-pearl:hover { background: #f0f0f3; color: var(--ap-ink); text-decoration: none; }

.ap-btn-large {
  font-size: 18px;
  font-weight: 300;
  padding: 14px 28px;
  min-height: 48px;
}

.ap-btn[disabled],
.ap-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ap-btn[disabled]:active,
.ap-btn:disabled:active { transform: none; }

/* ---------------------------------------------------------------------------
   Form: tile-based sections, no card chrome
   The classic .form-section becomes a tile-inner block.
   --------------------------------------------------------------------------- */

.form-section {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  box-shadow: none;
}

.form-section h2 {
  font-family: var(--ap-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.10;
  letter-spacing: 0;
  text-align: center;
  margin: 0 0 48px 0;
  color: var(--ap-ink);
}

.form-section h3 {
  font-family: var(--ap-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.21;
  letter-spacing: 0.007em;
  margin: 0 0 16px 0;
  color: var(--ap-ink);
}

.form-section h4 {
  font-family: var(--ap-text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.022em;
  margin: 0 0 12px 0;
  color: var(--ap-ink);
}

/* ---------------------------------------------------------------------------
   Form groups — labels above inputs, generous breathing room
   --------------------------------------------------------------------------- */

.form-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.016em;
  color: var(--ap-ink);
  margin: 0;
}

.form-group small {
  font-family: var(--ap-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ap-ink-48);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea,
input[type="text"]:not(.ap-bare),
input[type="email"]:not(.ap-bare),
input[type="password"]:not(.ap-bare),
select:not(.ap-bare),
textarea:not(.ap-bare) {
  font-family: var(--ap-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.022em;
  color: var(--ap-ink);
  background-color: var(--ap-canvas);
  border: 1px solid var(--ap-hairline);
  border-radius: var(--ap-r-md);
  padding: 12px 16px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

/* Native option list — must be explicitly themed; otherwise dropdown
   inherits OS defaults and reads white-on-white in dark mode. */
.form-group select option,
select:not(.ap-bare) option {
  background-color: var(--ap-canvas);
  color: var(--ap-ink);
}

.form-group textarea,
textarea:not(.ap-bare) {
  border-radius: var(--ap-r-lg);
  min-height: 84px;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ap-primary-focus);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}

.form-group select,
select:not(.ap-bare) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%231d1d1f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 44px;
}

::placeholder { color: var(--ap-ink-48); opacity: 1; }

/* Label + button row (e.g., upload alongside label) */
.label-with-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.label-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  font-size: 18px;
  line-height: 1;
}

.upload-btn-small {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ap-pearl);
  color: var(--ap-ink-80);
  border: 1px solid var(--ap-divider-soft);
  border-radius: var(--ap-r-pill);
  padding: 8px 16px;
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.016em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.upload-btn-small:hover { background: #f0f0f3; color: var(--ap-ink); }
.upload-btn-small:active { transform: scale(0.95); }
.upload-btn-small.uploaded { background: rgba(0, 102, 204, 0.08); color: var(--ap-primary); border-color: rgba(0, 102, 204, 0.24); }

.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.file-status {
  font-family: var(--ap-text);
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--ap-ink-48);
  margin-top: 4px;
  min-height: 18px;
}

.file-status:not(:empty) { color: var(--ap-primary); }

/* Toggle-secret eye button inside password field row */
.credential-field {
  position: relative;
  margin-bottom: 16px;
}

.credential-field label {
  display: block;
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.016em;
  color: var(--ap-ink);
  margin-bottom: 8px;
}

.credential-field input { padding-right: 44px; }

.toggle-secret {
  position: absolute;
  right: 8px;
  bottom: 6px;
  background: transparent;
  border: 0;
  font-size: 16px;
  color: var(--ap-ink-48);
  padding: 8px;
  cursor: pointer;
  border-radius: var(--ap-r-pill);
  transition: background 0.15s ease;
}

.toggle-secret:hover { background: rgba(0, 0, 0, 0.04); }

.required-note {
  font-family: var(--ap-text);
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--ap-ink-48);
  margin-top: 24px;
  text-align: right;
}

/* Checkbox label rows */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.016em;
  color: var(--ap-ink);
  padding: 8px 0;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ap-primary);
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Workflow tabs (top-level: New Report / From Cache)
   Pill-chip grammar; transparent → Action Blue when active.
   --------------------------------------------------------------------------- */

.workflow-tabs {
  display: inline-flex;
  gap: 6px;
  background: var(--ap-pearl);
  border: 1px solid var(--ap-divider-soft);
  border-radius: var(--ap-r-pill);
  padding: 4px;
  margin: 0 auto 32px auto;
}

.workflow-tabs {
  display: flex;
  width: fit-content;
}

.workflow-tab-btn {
  background: transparent;
  border: 0;
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.016em;
  color: var(--ap-ink-80);
  padding: 8px 18px;
  border-radius: var(--ap-r-pill);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.workflow-tab-btn:hover { color: var(--ap-ink); }
.workflow-tab-btn:active { transform: scale(0.95); }
.workflow-tab-btn.active {
  background: var(--ap-ink);
  color: var(--ap-on-dark);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Wrap the workflow-tabs in a centered row */
.ap-tab-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  margin-bottom: 32px;
}

/* Push messages above the tabs so they don't get clipped */
.message-container { position: relative; z-index: 5; }
.message-container:not(:empty) { margin-bottom: 24px; }

/* ---------------------------------------------------------------------------
   Credential tabs (inside the form)
   --------------------------------------------------------------------------- */

.credential-tabs {
  display: flex;
  gap: 4px;
  background: var(--ap-pearl);
  border: 1px solid var(--ap-divider-soft);
  border-radius: var(--ap-r-pill);
  padding: 4px;
  width: fit-content;
  margin: 8px 0 12px 0;
}

.credential-tab {
  background: transparent;
  border: 0;
  font-family: var(--ap-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.016em;
  color: var(--ap-ink-80);
  padding: 6px 14px;
  border-radius: var(--ap-r-pill);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.credential-tab.active {
  background: var(--ap-canvas);
  color: var(--ap-ink);
  box-shadow: 0 0 0 1px var(--ap-divider-soft);
}

.credential-tab-content { margin-top: 8px; }

.credentials-parsed {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(0, 102, 204, 0.06);
  border: 1px solid rgba(0, 102, 204, 0.18);
  border-radius: var(--ap-r-md);
  padding: 14px 16px;
  margin-top: 12px;
}

.credentials-parsed strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ap-ink);
  margin-bottom: 4px;
}

.credentials-parsed p {
  margin: 0;
  font-size: 13px;
  color: var(--ap-ink-80);
  font-family: var(--ap-text);
}

.success-icon { font-size: 18px; }

/* ---------------------------------------------------------------------------
   Collapsible sections — quiet hairline, no card chrome
   --------------------------------------------------------------------------- */

.collapsible-section {
  border-top: 1px solid var(--ap-hairline);
  margin: 0;
  padding: 0;
}

.collapsible-section:last-of-type {
  border-bottom: 1px solid var(--ap-hairline);
}

.collapsible-header {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: var(--ap-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.011em;
  color: var(--ap-ink);
  transition: color 0.15s ease;
}

.collapsible-header:hover { color: var(--ap-primary); }

.collapse-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--ap-r-pill);
  background: var(--ap-pearl);
  border: 1px solid var(--ap-divider-soft);
  color: var(--ap-ink);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.2s ease, background 0.15s ease;
}

.collapsible-section.open .collapse-icon { transform: rotate(45deg); }

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible-section.open .collapsible-content { max-height: 4000px; }

.collapsible-content-inner {
  padding: 8px 8px 28px 8px;
}

/* ---------------------------------------------------------------------------
   Info banners (Pro Tip / Warning)
   --------------------------------------------------------------------------- */

.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--ap-parchment);
  border: 1px solid var(--ap-hairline-strong);
  border-radius: var(--ap-r-md);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.info-banner.warning {
  background: var(--ap-parchment);
  border-color: var(--ap-hairline-strong);
}

.info-banner strong {
  display: block;
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.016em;
  color: var(--ap-ink);
  margin-bottom: 4px;
}

.info-banner p {
  font-family: var(--ap-text);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ap-ink-80);
  margin: 0;
}

/* ---------------------------------------------------------------------------
   Divider
   --------------------------------------------------------------------------- */

.divider {
  height: 1px;
  background: var(--ap-hairline);
  border: 0;
  margin: 32px 0;
}

/* ---------------------------------------------------------------------------
   Submit / form actions
   --------------------------------------------------------------------------- */

.form-actions {
  display: flex;
  justify-content: center;
  padding: 0;
  margin-top: 32px;
  background: transparent;
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--ap-primary);
  color: var(--ap-on-dark);
  border: 0;
  border-radius: var(--ap-r-pill);
  padding: 14px 32px;
  font-family: var(--ap-text);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.022em;
  cursor: pointer;
  min-height: 48px;
  min-width: 220px;
  transition: background 0.15s ease, transform 0.12s ease;
}

.submit-btn:hover { background: #0077ed; }
.submit-btn:active { transform: scale(0.95); }
.submit-btn:focus-visible { outline: 2px solid var(--ap-primary-focus); outline-offset: 3px; }
.submit-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.submit-btn[disabled]:active { transform: none; }

.submit-btn .btn-icon { font-size: 18px; line-height: 1; }

/* ---------------------------------------------------------------------------
   Progress bar
   --------------------------------------------------------------------------- */

.progress-container {
  background: var(--ap-parchment);
  border: 1px solid var(--ap-hairline);
  border-radius: var(--ap-r-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--ap-divider-soft);
  border-radius: var(--ap-r-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--ap-primary);
  border-radius: var(--ap-r-pill);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-family: var(--ap-text);
  font-size: 14px;
  letter-spacing: -0.016em;
  color: var(--ap-ink-80);
  margin: 12px 0 0 0;
  text-align: center;
}

/* ---------------------------------------------------------------------------
   Message container (toast-style alerts)
   --------------------------------------------------------------------------- */

.message-container { margin-bottom: 16px; }

.message-container .message {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--ap-r-md);
  font-family: var(--ap-text);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: -0.016em;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.message-container .message-label {
  flex: 0 0 auto;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--ap-r-pill);
  background: rgba(0, 0, 0, 0.06);
}

.message-container .message.success .message-label { background: rgba(40, 167, 69, 0.16); }
.message-container .message.error   .message-label { background: rgba(220, 53, 69, 0.16); }
.message-container .message.info    .message-label { background: rgba(0, 102, 204, 0.16); }
.message-container .message.warning .message-label { background: rgba(241, 196, 15, 0.20); }

.message-container .message.warning {
  background: rgba(241, 196, 15, 0.10);
  border-color: rgba(241, 196, 15, 0.30);
  color: #8a6d0d;
}

/* Dark-mode label pill needs lighter alpha base */
[data-theme="dark"] .message-container .message-label { background: rgba(255, 255, 255, 0.10); }
[data-theme="dark"] .message-container .message.success .message-label { background: rgba(48, 209, 88, 0.22); }
[data-theme="dark"] .message-container .message.error   .message-label { background: rgba(255, 69, 58, 0.22); }
[data-theme="dark"] .message-container .message.info    .message-label { background: rgba(41, 151, 255, 0.22); }
[data-theme="dark"] .message-container .message.warning {
  background: rgba(241, 196, 15, 0.14);
  border-color: rgba(241, 196, 15, 0.36);
  color: #ffd60a;
}

.message-container .message.success {
  background: rgba(40, 167, 69, 0.06);
  border-color: rgba(40, 167, 69, 0.22);
  color: #1d6f3f;
}

.message-container .message.error {
  background: rgba(220, 53, 69, 0.06);
  border-color: rgba(220, 53, 69, 0.22);
  color: #a01928;
}

.message-container .message.info {
  background: rgba(0, 102, 204, 0.06);
  border-color: rgba(0, 102, 204, 0.22);
  color: var(--ap-primary);
}

/* ---------------------------------------------------------------------------
   Footer (parchment, dense links)
   --------------------------------------------------------------------------- */

.ap-footer {
  background: var(--ap-parchment);
  color: var(--ap-ink-80);
  padding: 48px 32px 32px 32px;
  border-top: 1px solid var(--ap-hairline);
  text-align: center;
}

.ap-footer p {
  font-family: var(--ap-text);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--ap-ink-48);
  margin: 0;
}

.ap-footer a {
  color: var(--ap-ink-80);
  text-decoration: none;
}

.ap-footer a:hover { color: var(--ap-primary); text-decoration: underline; }

.ap-footer-links {
  margin-bottom: 8px !important;
  font-size: 13px !important;
  color: var(--ap-ink-80) !important;
}

.ap-footer-links a { color: var(--ap-ink-80); }

/* Hide classic footer if it leaks through */
footer:not(.ap-footer) { display: none; }

/* ---------------------------------------------------------------------------
   Modal (What's New)
   --------------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 24px;
}

.modal-content {
  background: var(--ap-canvas);
  border-radius: var(--ap-r-lg);
  max-width: 720px;
  width: 100%;
  max-height: 86vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ap-hairline);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px 28px;
  border-bottom: 1px solid var(--ap-hairline);
}

.modal-header h2 {
  font-family: var(--ap-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.007em;
  color: var(--ap-ink);
  margin: 0;
}

.modal-close {
  background: var(--ap-pearl);
  border: 1px solid var(--ap-divider-soft);
  border-radius: var(--ap-r-pill);
  width: 36px;
  height: 36px;
  font-size: 20px;
  color: var(--ap-ink);
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.12s ease;
}

.modal-close:hover { background: #f0f0f3; }
.modal-close:active { transform: scale(0.95); }

.modal-body {
  padding: 24px 28px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 28px 24px 28px;
  border-top: 1px solid var(--ap-hairline);
}

.modal-btn-primary {
  background: var(--ap-primary);
  color: var(--ap-on-dark);
  border: 0;
  border-radius: var(--ap-r-pill);
  padding: 11px 22px;
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.016em;
  cursor: pointer;
  min-height: 40px;
  transition: background 0.15s ease, transform 0.12s ease;
}

.modal-btn-primary:hover { background: #0077ed; }
.modal-btn-primary:active { transform: scale(0.95); }

.changelog-version {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ap-hairline);
}

.changelog-version:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }

.changelog-version h3 {
  font-family: var(--ap-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.011em;
  color: var(--ap-ink);
  margin: 0 0 12px 0;
}

.changelog-section { margin-top: 16px; }

.changelog-section h4 {
  font-family: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.016em;
  color: var(--ap-primary);
  margin: 0 0 8px 0;
}

.changelog-section ul {
  margin: 0;
  padding-left: 22px;
}

.changelog-section li {
  font-family: var(--ap-text);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.016em;
  color: var(--ap-ink-80);
  margin-bottom: 4px;
}

.changelog-section li strong { color: var(--ap-ink); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Blueprint builder rows (JS-generated; keep it quiet)
   --------------------------------------------------------------------------- */

.blueprint-item,
.cache-blueprint-item {
  border: 1px solid var(--ap-hairline);
  border-radius: var(--ap-r-md);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--ap-canvas);
}

.blueprint-item input,
.blueprint-item textarea,
.cache-blueprint-item input,
.cache-blueprint-item textarea {
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--ap-r-sm);
}

/* ---------------------------------------------------------------------------
   Inline JS-styled buttons (e.g., "+ Add Blueprint")
   These were inline-styled in classic; rein them in here.
   --------------------------------------------------------------------------- */

button[onclick*="addBlueprint"],
button[onclick*="addCacheBlueprint"] {
  background: var(--ap-primary) !important;
  color: var(--ap-on-dark) !important;
  border: 0 !important;
  border-radius: var(--ap-r-pill) !important;
  padding: 8px 16px !important;
  font-family: var(--ap-text) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  letter-spacing: -0.016em !important;
  min-height: 36px;
  transition: background 0.15s ease, transform 0.12s ease;
}

button[onclick*="addBlueprint"]:hover,
button[onclick*="addCacheBlueprint"]:hover { background: #0077ed !important; }
button[onclick*="addBlueprint"]:active,
button[onclick*="addCacheBlueprint"]:active { transform: scale(0.95); }

/* Cache regenerate is a primary action — strip the classic gradient override */
#regenerate-btn {
  background: var(--ap-primary) !important;
}

#regenerate-btn:hover { background: #0077ed !important; }

/* ---------------------------------------------------------------------------
   Hide elements specific to the classic skin
   (theme toggle, classic user-info chrome — replaced by global nav)
   --------------------------------------------------------------------------- */

.theme-toggle-btn,
.whats-new-btn-classic { display: none; }

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

@media (max-width: 1068px) {
  .ap-hero h1 { font-size: 48px; }
  .form-section h2,
  .ap-section-head h2 { font-size: 34px; }
}

/* Brand-text swap: full at desktop, short on phone */
.ap-gnav-brand-short { display: none; }

/* Hide-utility classes used in nav */
.ap-hide-tablet { /* visible on desktop */ }
.ap-hide-mobile { /* visible on tablet & desktop */ }

@media (max-width: 833px) {
  .ap-tile { padding: 56px 22px; }
  .ap-hero h1 { font-size: 40px; }
  .ap-hero .ap-tagline { font-size: 22px; }
  .form-section h2,
  .ap-section-head h2 { font-size: 28px; }
  .ap-sub-nav { padding: 0 18px; }
  .ap-sub-nav .ap-subnav-title { font-size: 18px; }
  .ap-sub-nav .ap-subnav-actions { gap: 12px; }
  .ap-global-nav { padding: 0 16px; }
  .ap-global-nav .ap-gnav-left,
  .ap-global-nav .ap-gnav-right { gap: 16px; }
  .ap-hide-tablet { display: none !important; }
  /* At tablet, also drop the Switch-UI link — power-user action stays desktop-only */
  .ap-gnav-right a[href*="ui=classic"] { display: none !important; }
}

@media (max-width: 640px) {
  .form-section h2,
  .ap-section-head h2 { font-size: 24px; }
  .label-with-button { flex-direction: column; align-items: flex-start; }
  .upload-row { flex-direction: column; align-items: flex-start; }
  .submit-btn { width: 100%; }
  .ap-footer { padding: 32px 18px 24px 18px; }

  /* Phone nav: brand mark + theme toggle + Logout. Everything else hides.
     Keep heights at desktop values so sticky offsets stay aligned. */
  .ap-global-nav { padding: 0 14px; }
  .ap-global-nav .ap-gnav-left,
  .ap-global-nav .ap-gnav-right { gap: 12px; }
  .ap-gnav-brand-full { display: none; }
  .ap-gnav-brand-short { display: inline; }
  .ap-hide-mobile { display: none !important; }

  /* Sub-nav: title + Generate only */
  .ap-sub-nav { padding: 0 14px; }
  .ap-sub-nav .ap-subnav-title { font-size: 17px; }
  .ap-sub-nav .ap-btn-primary { padding: 8px 16px; font-size: 14px; min-height: 36px; }

  /* Hero — trim further so the form is reachable above the fold */
  .ap-tile { padding: 32px 18px; }
  .ap-hero { gap: 12px; }
  .ap-hero h1 { font-size: 28px; line-height: 1.12; }
  .ap-hero .ap-tagline { font-size: 17px; line-height: 1.3; }
  .ap-hero .ap-hcs-mark { height: 44px; }
  .ap-hero .ap-eyebrow { font-size: 12px; }
}

@media (max-width: 480px) {
  .ap-hero h1 { font-size: 28px; line-height: 1.1; }
  .form-section h2,
  .ap-section-head h2 { font-size: 22px; }
}

/* ===========================================================================
   Dark mode — tokens redefine, the whole system flips automatically.
   Apple's dark surfaces use the same near-black tile palette as the dark
   product tiles. Action Blue (#0066cc) reads cleanly on tile-1 already,
   so the primary CTA does not need a swap.
   =========================================================================== */

[data-theme="dark"] {
  /* Surfaces flip to the tile palette; canvas becomes tile-1 */
  --ap-canvas: #1d1d1f;       /* near-black ink, used as page surface */
  --ap-parchment: #161617;    /* one micro-step darker for alternation */
  --ap-pearl: #2a2a2c;        /* lifted secondary surface (was near-white) */

  /* Text inverts */
  --ap-ink: #f5f5f7;
  --ap-ink-80: #d2d2d7;
  --ap-ink-48: #86868b;

  /* Hairlines on dark */
  --ap-hairline: rgba(255, 255, 255, 0.10);
  --ap-divider-soft: rgba(255, 255, 255, 0.06);
  --ap-hairline-strong: rgba(255, 255, 255, 0.14);
}

/* Body background */
[data-theme="dark"] body { background: var(--ap-canvas); }

/* Sub-nav frosted parchment → frosted near-black */
[data-theme="dark"] .ap-sub-nav {
  background: rgba(22, 22, 23, 0.78);
  border-bottom-color: var(--ap-hairline-strong);
}

/* Inline button hovers that hard-coded a light hex */
[data-theme="dark"] .ap-btn-pearl:hover,
[data-theme="dark"] .upload-btn-small:hover,
[data-theme="dark"] .modal-close:hover { background: #3a3a3c; color: var(--ap-ink); }

[data-theme="dark"] .ap-btn-dark { background: var(--ap-pearl); }
[data-theme="dark"] .ap-btn-dark:hover { background: #3a3a3c; }

/* Inputs: dark surface needs a lifted, slightly lighter input fill */
[data-theme="dark"] .form-group input[type="text"],
[data-theme="dark"] .form-group input[type="email"],
[data-theme="dark"] .form-group input[type="password"],
[data-theme="dark"] .form-group input[type="number"],
[data-theme="dark"] .form-group input[type="url"],
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] input[type="text"]:not(.ap-bare),
[data-theme="dark"] input[type="email"]:not(.ap-bare),
[data-theme="dark"] input[type="password"]:not(.ap-bare),
[data-theme="dark"] select:not(.ap-bare),
[data-theme="dark"] textarea:not(.ap-bare) {
  background-color: #2a2a2c;
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ap-ink);
}

[data-theme="dark"] .form-group select option,
[data-theme="dark"] select:not(.ap-bare) option {
  background-color: #2a2a2c;
  color: var(--ap-ink);
}

[data-theme="dark"] ::placeholder { color: #86868b; }

/* Select chevron needs a light stroke on dark */
[data-theme="dark"] .form-group select,
[data-theme="dark"] select:not(.ap-bare) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23f5f5f7' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Workflow tabs container becomes a dark pearl with light divider */
[data-theme="dark"] .workflow-tabs,
[data-theme="dark"] .credential-tabs {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .workflow-tab-btn { color: var(--ap-ink-80); }
[data-theme="dark"] .workflow-tab-btn:hover { color: var(--ap-ink); }
[data-theme="dark"] .workflow-tab-btn.active { background: var(--ap-ink); color: var(--ap-canvas); }

[data-theme="dark"] .credential-tab.active {
  background: rgba(255, 255, 255, 0.10);
  color: var(--ap-ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Info banners — neutral surface on dark */
[data-theme="dark"] .info-banner {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--ap-hairline-on-dark);
}

[data-theme="dark"] .info-banner.warning {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--ap-hairline-on-dark);
}

/* Inline links inside body text on dark */
[data-theme="dark"] a { color: var(--ap-primary-on-dark); }
[data-theme="dark"] .ap-footer a { color: var(--ap-ink-80); }
[data-theme="dark"] .ap-footer a:hover { color: var(--ap-primary-on-dark); }

/* Credentials-parsed info card */
[data-theme="dark"] .credentials-parsed {
  background: rgba(41, 151, 255, 0.10);
  border-color: rgba(41, 151, 255, 0.28);
}
[data-theme="dark"] .credentials-parsed strong { color: var(--ap-ink); }
[data-theme="dark"] .credentials-parsed p { color: var(--ap-ink-80); }

/* Toast messages */
[data-theme="dark"] .message-container .message.success {
  background: rgba(48, 209, 88, 0.10);
  border-color: rgba(48, 209, 88, 0.30);
  color: #4ade80;
}
[data-theme="dark"] .message-container .message.error {
  background: rgba(255, 69, 58, 0.10);
  border-color: rgba(255, 69, 58, 0.30);
  color: #ff6b6b;
}
[data-theme="dark"] .message-container .message.info {
  background: rgba(41, 151, 255, 0.10);
  border-color: rgba(41, 151, 255, 0.28);
  color: var(--ap-primary-on-dark);
}

/* Modal */
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.66); }
[data-theme="dark"] .modal-content { background: var(--ap-pearl); border-color: var(--ap-hairline-strong); }
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer { border-color: var(--ap-hairline); }

/* Blueprint builder cards */
[data-theme="dark"] .blueprint-item,
[data-theme="dark"] .cache-blueprint-item {
  background: var(--ap-pearl);
  border-color: var(--ap-hairline);
}

/* Progress bar track */
[data-theme="dark"] .progress-container {
  background: var(--ap-pearl);
  border-color: var(--ap-hairline);
}
[data-theme="dark"] .progress-bar { background: rgba(255, 255, 255, 0.10); }

/* ---------------------------------------------------------------------------
   Profile pill strip — appears above each tab's form when saved profiles exist
   --------------------------------------------------------------------------- */

.profile-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 16px 0 24px 0;
  margin: 0;
}

.profile-strip-label {
  font-family: var(--ap-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ap-ink-48);
  margin-right: 6px;
}

.profile-pill {
  display: inline-flex;
  align-items: stretch;
  background: var(--ap-pearl);
  border: 1px solid var(--ap-divider-soft);
  border-radius: var(--ap-r-pill);
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.profile-pill:hover { background: #f0f0f3; border-color: var(--ap-hairline); }

.profile-pill-name {
  background: transparent;
  border: 0;
  color: var(--ap-ink);
  font-family: var(--ap-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.016em;
  padding: 7px 6px 7px 14px;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-pill-name:hover { color: var(--ap-primary); }

.profile-pill-del {
  background: transparent;
  border: 0;
  color: var(--ap-ink-48);
  font-size: 11px;
  cursor: pointer;
  padding: 0 12px;
  border-left: 1px solid var(--ap-divider-soft);
  transition: color 0.15s ease, background 0.15s ease;
}

.profile-pill-del:hover { color: #ff3b30; background: rgba(255, 59, 48, 0.06); }

[data-theme="dark"] .profile-pill {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .profile-pill:hover { background: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .profile-pill-del { border-left-color: rgba(255, 255, 255, 0.10); }


/* Theme toggle button — small pill in the global nav, state-reflective */
.ap-theme-toggle {
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: var(--ap-on-dark);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--ap-r-pill);
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.12s ease;
}
.ap-theme-toggle:hover { background: rgba(255, 255, 255, 0.22); }
.ap-theme-toggle:active { transform: scale(0.95); }
.ap-theme-toggle .ap-theme-icon { display: inline-block; }

/* In dark mode, swap to a sun-glow pill so the active state is obvious */
[data-theme="dark"] .ap-theme-toggle {
  background: rgba(255, 204, 0, 0.18);
  color: #ffd60a;
}
[data-theme="dark"] .ap-theme-toggle:hover { background: rgba(255, 204, 0, 0.30); }


/* ===========================================================================
   APPLE HIG "LIQUID GLASS" LAYER
   Captured from Apple's Content Caching Deployment Advisor (Aug 2026).
   Appended last so it wins by cascade. Scoped naturally: apple.css is loaded
   only by index_apple.html. Dark tokens hang off the host's [data-theme].
   =========================================================================== */

:root {
  /* HIG semantic system colors — light */
  --system-blue: #007AFF;
  --system-purple: #AF52DE;
  --system-orange: #FF9500;
  --system-teal: #5AC8FA;
  --system-red: #FF3B30;
  --system-green: #34C759;
  --system-gray: #8E8E93;
  --system-gray2: #AEAEB2;
  --system-gray3: #C7C7CC;
  --system-gray4: #D1D1D6;
  --system-gray5: #E5E5EA;
  --system-gray6: #F2F2F7;

  --label: #000;
  --secondary-label: rgba(60, 60, 67, 0.6);
  --tertiary-label: rgba(60, 60, 67, 0.3);
  --background: #FFF;
  --secondary-background: #F2F2F7;
  --separator: rgba(60, 60, 67, 0.29);

  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] {
  --system-blue: #0A84FF;
  --system-purple: #BF5AF2;
  --system-orange: #FF9F0A;
  --system-red: #FF453A;
  --system-green: #32D74B;
  --system-gray2: #636366;
  --system-gray3: #48484A;
  --system-gray4: #3A3A3C;
  --system-gray5: #2C2C2E;
  --system-gray6: #1C1C1E;

  --label: #FFF;
  --secondary-label: rgba(235, 235, 245, 0.6);
  --tertiary-label: rgba(235, 235, 245, 0.3);
  --background: #000;
  --secondary-background: #1C1C1E;
  --separator: rgba(84, 84, 88, 0.65);

  --glass-bg: rgba(30, 30, 32, 0.72);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --glass-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* --- Ground: paint html too, or a band shows under short pages ------------ */
html { background: var(--secondary-background); }

body {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(0, 122, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(175, 82, 222, 0.06) 0%, transparent 60%),
    var(--secondary-background);
  background-attachment: fixed;
  color: var(--label);
}

/* --- The one glass recipe ------------------------------------------------- */
.liquid-glass,
.ap-sub-nav,
main.ap-tile-parch .form-section,
main.ap-tile-parch .collapsible-section,
.profile-strip,
.info-banner,
.progress-container,
.modal-content {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inset);
  border-radius: 16px;
}

/* --- Layout: tool column, not marketing bleed ----------------------------- */
.ap-tile { padding: 24px 20px 40px; background: transparent !important; }
.ap-tile-inner { max-width: 900px; }
main.ap-tile-parch { padding-bottom: 120px; }
main.ap-tile-parch .main-content { background: transparent; }

/* Hero reads as a tool header, not a splash */
header.ap-tile-light { padding: 28px 20px 4px; }
header.ap-tile-light .ap-hero { text-align: left; }
header.ap-tile-light h1 {
  font-size: 28px !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--label);
}
header.ap-tile-light .ap-tagline,
header.ap-tile-light .ap-eyebrow { color: var(--secondary-label); }

/* Sticky app header */
.ap-sub-nav {
  border-radius: 0 0 16px 16px;
  border-top: 0;
  height: auto;
  padding: 14px 24px;
}
.ap-subnav-title { color: var(--label); font-size: 17px; font-weight: 600; }

/* --- Section cards -------------------------------------------------------- */
main.ap-tile-parch .form-section {
  padding: 24px;
  margin-bottom: 20px;
}
main.ap-tile-parch .form-section h2 {
  font-family: var(--ap-text);
  font-size: 17px !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--label);
  margin: 0 0 18px;
}

/* Collapsibles become their own glass cards (no hairline rails) */
main.ap-tile-parch .collapsible-section {
  border-top: 0 !important;
  border-bottom: 0 !important;
  margin-bottom: 12px;
  overflow: hidden;
}
main.ap-tile-parch .collapsible-section:last-of-type { border-bottom: 0 !important; }
main.ap-tile-parch .collapsible-header {
  padding: 16px 20px;
  font-family: var(--ap-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--label);
}
main.ap-tile-parch .collapsible-content-inner { padding: 0 20px 20px; }

/* --- Form controls -------------------------------------------------------- */
main.ap-tile-parch input[type="text"],
main.ap-tile-parch input[type="email"],
main.ap-tile-parch input[type="password"],
main.ap-tile-parch input[type="number"],
main.ap-tile-parch input[type="url"],
main.ap-tile-parch select,
main.ap-tile-parch textarea {
  background: var(--background) !important;
  border: 1px solid var(--separator) !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  font-size: 15px !important;
  color: var(--label) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
main.ap-tile-parch input:focus,
main.ap-tile-parch select:focus,
main.ap-tile-parch textarea:focus {
  outline: none;
  border-color: var(--system-blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15) !important;
}
main.ap-tile-parch .form-group > label {
  font-size: 14px;
  font-weight: 500;
  color: var(--label);
}
main.ap-tile-parch .form-group small,
main.ap-tile-parch .file-status { font-size: 12px; color: var(--secondary-label); }

/* --- Tabs: underline, not pills ------------------------------------------ */
.ap-tab-row { border-bottom: 1px solid var(--separator); margin-bottom: 20px; }
.workflow-tabs { gap: 4px; }
.workflow-tab-btn {
  border-radius: 0 !important;
  background: transparent !important;
  padding: 10px 20px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--secondary-label) !important;
  border-bottom: 2px solid transparent !important;
  transform: none !important;
}
.workflow-tab-btn.active {
  color: var(--system-blue) !important;
  border-bottom-color: var(--system-blue) !important;
}

/* --- Buttons -------------------------------------------------------------- */
.submit-btn {
  width: 100%;
  background: var(--system-blue) !important;
  color: #fff !important;
  border-radius: 12px !important;
  padding: 16px 24px !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.submit-btn:active:not(:disabled) { transform: scale(0.98); }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.form-actions {
  position: sticky;
  bottom: 20px;
  z-index: 50;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inset);
  border-radius: 16px;
  padding: 12px;
  margin-top: 20px;
}

.upload-btn-small,
.toggle-secret {
  border-radius: 8px !important;
  border: 1px solid var(--separator) !important;
  background: var(--background) !important;
  color: var(--system-blue) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 6px 14px !important;
}
.upload-btn-small.uploaded {
  background: rgba(52, 199, 89, 0.1) !important;
  border-color: rgba(52, 199, 89, 0.3) !important;
  color: var(--system-green) !important;
}

/* --- Banners: tint = meaning, never decoration --------------------------- */
.info-banner {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13px;
}
.info-banner strong { font-size: 14px; color: var(--label); }
.info-banner p { color: var(--secondary-label); }

/* --- Progress ------------------------------------------------------------- */
.progress-container { padding: 18px 20px; margin-bottom: 20px; }
.progress-bar {
  background: var(--system-gray5) !important;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill { background: var(--system-blue) !important; }
.progress-text { color: var(--secondary-label); font-size: 13px; }

/* --- Modal ---------------------------------------------------------------- */
.modal-overlay { background: rgba(0, 0, 0, 0.4); }
.modal-content { max-width: 620px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.modal-header h2 { font-size: 20px; font-weight: 600; color: var(--label); }
.changelog-version h3 { color: var(--system-blue); font-size: 15px; font-weight: 600; }
.changelog-section h4 { font-size: 14px; font-weight: 600; color: var(--label); }
.changelog-section li { font-size: 13px; color: var(--secondary-label); }

/* --- Profile strip -------------------------------------------------------- */
.profile-strip { padding: 14px 18px; margin-bottom: 20px; }

/* --- Focus ---------------------------------------------------------------- */
main.ap-tile-parch a:focus-visible,
main.ap-tile-parch button:focus-visible,
main.ap-tile-parch input:focus-visible,
main.ap-tile-parch select:focus-visible,
.ap-sub-nav a:focus-visible,
.ap-sub-nav button:focus-visible {
  outline: 2px solid var(--system-blue);
  outline-offset: 2px;
}

/* --- Mobile --------------------------------------------------------------- */
@media (max-width: 600px) {
  header.ap-tile-light h1 { font-size: 22px !important; }
  main.ap-tile-parch .form-section { padding: 18px; }
  .ap-tile { padding: 16px 14px 32px; }
}

/* --- Print: strip glass to plain white ------------------------------------ */
@media print {
  html, body { background: #fff !important; }
  .ap-global-nav, .ap-sub-nav, .form-actions, .ap-footer { display: none !important; }
  .liquid-glass, .form-section, .collapsible-section, .info-banner, .progress-container {
    background: #fff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* --- Glass layer: corrections after visual pass --------------------------- */

/* Tabs: kill the inherited pill container, underline only */
.workflow-tabs {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.workflow-tab-btn:hover { background: transparent !important; color: var(--label) !important; }

/* Hero at tool scale */
header.ap-tile-light .ap-hero { gap: 10px; }
header.ap-tile-light .ap-hero .ap-hcs-mark { height: 40px; margin-bottom: 0; }
header.ap-tile-light .ap-eyebrow {
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary-label) !important;
}
header.ap-tile-light .ap-tagline {
  font-family: var(--ap-text) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  line-height: 1.45 !important;
  color: var(--secondary-label) !important;
  max-width: 700px;
  text-wrap: balance;
}

/* Sticky CTA must not sit on top of the last field */
.tab-content { padding-bottom: 8px; }
.form-actions { margin-top: 28px; }

/* Footer blends into the wash instead of banding */
.ap-footer {
  background: transparent !important;
  border-top: 1px solid var(--separator);
  color: var(--secondary-label);
}
.ap-footer a { color: var(--secondary-label); }
.ap-footer a:hover { color: var(--system-blue); }
