:root {
  --app-bg: #f4f7fb;
  --app-surface: #ffffff;
  --app-surface-soft: #fbfdff;
  --app-surface-muted: #f8fafc;
  --app-text: #0f172a;
  --app-muted: #64748b;
  --app-border: #dbe4ef;
  --app-border-soft: #e8eef5;
  --app-brand: #f59e0b;
  --app-brand-hover: #dc8505;
  --app-brand-soft: #fffbeb;
  --app-brand-text: #b45309;
  --app-secondary: #334155;
  --app-secondary-hover: #1e293b;
  --app-danger: #dc2626;
  --app-radius-xs: 8px;
  --app-radius-sm: 12px;
  --app-radius-md: 16px;
  --app-shadow-soft: 0 1px 2px rgba(15, 23, 42, .06);
  --app-container: 72rem;
  --app-header-min-height: 5rem;
  --app-space-page-x: 1rem;
  --app-space-page-y: 1.75rem;
  --app-transition-fast: .15s ease;
  --app-transition-base: .2s ease;
}

* {
  box-sizing: border-box;
}

body {
  font-family: Inter, sans-serif;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--app-border);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(8px);
}

.app-header-inner {
  width: 100%;
  max-width: var(--app-container);
  min-height: var(--app-header-min-height);
  margin: 0 auto;
  padding: .75rem var(--app-space-page-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-brand-link {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
  color: inherit;
  text-decoration: none;
}

.app-brand-logo {
  width: auto;
  height: 2rem;
  object-fit: contain;
}

.app-brand-subtitle {
  max-width: 210px;
  overflow: hidden;
  color: var(--app-muted);
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.app-header-button {
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: var(--app-surface);
  color: var(--app-text);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--app-transition-base), border-color var(--app-transition-base), transform var(--app-transition-fast);
}

.app-header-button:hover {
  background: var(--app-surface-muted);
}

.app-header-button:active {
  transform: scale(.98);
}

.app-header-button.primary {
  border-color: var(--app-brand);
  background: var(--app-brand);
  color: #ffffff;
}

.app-header-button.primary:hover {
  border-color: var(--app-brand-hover);
  background: var(--app-brand-hover);
}

.app-page-main {
  width: 100%;
  max-width: var(--app-container);
  margin: 0 auto;
  padding: var(--app-space-page-y) var(--app-space-page-x);
}

.utility-item {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  overflow: hidden;
}

.utility-summary {
  min-height: 80px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
}

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

.utility-summary:hover {
  background: var(--app-surface-muted);
}

.utility-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: var(--app-radius-sm);
  background: #f1f5f9;
  color: #ffb800;
  font-size: 20px;
}

.utility-chevron {
  color: var(--app-muted);
  font-size: 12px;
  transition: transform var(--app-transition-base);
}

details[open] .utility-chevron {
  transform: rotate(180deg);
}

.utility-body {
  border-top: 1px solid var(--app-border-soft);
  padding: 18px;
  background: var(--app-surface-soft);
}

.mini-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  background: var(--app-surface);
}

.action-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--app-radius-xs);
  padding: 9px 15px;
  background: var(--app-brand);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--app-transition-base), transform var(--app-transition-fast), opacity var(--app-transition-base);
}

.action-button:hover {
  background: var(--app-brand-hover);
}

.action-button:active {
  transform: scale(.98);
}

.action-button.secondary {
  background: var(--app-secondary);
}

.action-button.secondary:hover {
  background: var(--app-secondary-hover);
}

.action-button.is-loading,
.action-button[aria-busy="true"] {
  pointer-events: none;
  opacity: .82;
  position: relative;
}

.action-button.is-loading::after,
.action-button[aria-busy="true"]::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: app-spin .7s linear infinite;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--app-radius-xs);
  color: var(--app-muted);
}

.icon-button:hover {
  background: #f1f5f9;
  color: var(--app-brand);
}

.pill {
  min-height: 38px;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-xs);
  padding: 8px 12px;
  background: var(--app-surface);
  color: var(--app-secondary);
  font-size: 13px;
  font-weight: 700;
}

.pill:hover,
.pill.active {
  border-color: var(--app-brand);
  background: var(--app-brand-soft);
  color: var(--app-brand-text);
}

.modal-backdrop {
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(6px);
}

.link-popup-content {
  padding: 28px 24px 24px;
  text-align: center;
}

.link-popup-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border: 1px solid var(--app-border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--app-brand-soft);
  color: var(--app-brand);
  font-size: 24px;
}

.link-popup-spinner {
  width: 22px;
  height: 22px;
  margin: 0 auto 14px;
  border: 2px solid rgba(245, 158, 11, .25);
  border-top-color: var(--app-brand);
  border-radius: 50%;
  animation: app-spin .8s linear infinite;
}

.link-popup-title {
  margin: 0;
  color: var(--app-text);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.35;
}

.link-popup-description {
  margin: 8px auto 0;
  max-width: 430px;
  color: var(--app-muted);
  font-size: .875rem;
  line-height: 1.6;
}

.link-popup-countdown {
  margin-top: 10px;
  color: var(--app-muted);
  font-size: .875rem;
}

.link-popup-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.link-popup-note {
  margin-top: 14px;
  color: var(--app-muted);
  font-size: .75rem;
}

.action-button.disabled,
.action-button[aria-disabled="true"] {
  pointer-events: none;
  opacity: .55;
}

#toast {
  transition: opacity var(--app-transition-base), transform var(--app-transition-base);
}

@keyframes app-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 640px) {
  :root {
    --app-space-page-x: 1.5rem;
    --app-space-page-y: 2.25rem;
  }

  .app-brand-subtitle {
    max-width: none;
    font-size: .875rem;
  }
}

@media (min-width: 1024px) {
  :root {
    --app-space-page-x: 2rem;
  }
}

@media (max-width: 640px) {
  .app-header-button {
    padding: 0 .75rem;
  }

  .app-header-button-label.optional-mobile {
    display: none;
  }

  .utility-summary {
    min-height: 74px;
    padding: 12px;
  }

  .utility-body {
    padding: 14px;
  }
}
