.card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card h1,
.card h2,
.card h3 {
  margin-top: 0;
}

.lead {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
}

.premium-badge {
  border-color: #f59e0b;
  background: #fef3c7;
  color: #92400e;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
}

.button:disabled,
button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button.secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

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

.button.danger {
  background: var(--danger);
}

.button.danger:hover {
  background: #8f1d14;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select,
.field textarea,
.inline-form input,
.inline-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notice {
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 12px 14px;
  color: var(--muted);
}

.notice.error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.notice.success {
  border-left-color: var(--success);
  color: var(--success);
}

.app-toast-region {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  transform: translateX(-50%);
}

.app-toast {
  border: 1px solid rgba(37, 99, 235, 0.26);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  padding: 11px 14px;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.app-toast-success {
  border-color: rgba(22, 163, 74, 0.4);
  background: #f0fdf4;
  color: #166534;
}

.app-toast-error {
  border-color: rgba(180, 35, 24, 0.36);
  background: #fef2f2;
  color: var(--danger);
}

@media (prefers-reduced-motion: reduce) {
  .app-toast {
    transition: none;
  }
}

.profile-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.disabled-profile-status {
  position: relative;
}

.disabled-profile-status summary {
  border: 1px solid rgba(220, 38, 38, 0.5);
  border-radius: 999px;
  background: #fef2f2;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  list-style: none;
  padding: 5px 9px;
}

.disabled-profile-status summary::-webkit-details-marker {
  display: none;
}

.disabled-profile-status summary:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.disabled-profile-tooltip {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: min(300px, calc(100vw - 32px));
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 10px 12px;
}

.disabled-profile-status[open] .disabled-profile-tooltip,
.disabled-profile-status:hover .disabled-profile-tooltip,
.disabled-profile-status:focus-within .disabled-profile-tooltip {
  display: block;
}

.cookie-banner {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  display: flex;
  width: min(620px, calc(100% - 40px));
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.cookie-banner p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.cookie-banner a,
.legal-content a {
  color: var(--accent-dark);
}

.cookie-banner-actions {
  flex: 0 0 auto;
}

.legal-page {
  max-width: 860px;
  margin: 0 auto;
}

.legal-review-note {
  border-left: 4px solid #d97706;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
  line-height: 1.55;
  padding: 12px 14px;
}

.legal-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

.legal-navigation a {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  padding: 7px 11px;
  text-decoration: none;
}

.legal-navigation a:hover,
.legal-navigation a.active {
  border-color: var(--accent);
  background: #eff6ff;
  color: var(--accent-dark);
}

.legal-content {
  display: grid;
  gap: 20px;
  line-height: 1.6;
}

.legal-page > .lead,
.legal-review-note,
.legal-content p {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.legal-content h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.legal-content p {
  margin: 0;
}

.account-deletion-card {
  margin-top: 18px;
  border-color: rgba(180, 35, 24, 0.3);
}

.site-search-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.58);
  padding: 20px;
}

.site-search-modal {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(720px, 100%);
  height: min(660px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.26);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.34);
  padding: 22px;
}

.site-search-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.site-search-header h2 {
  margin: 10px 0 6px;
}

.site-search-header p {
  margin: 0;
}

.site-search-close {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--muted);
  cursor: pointer;
}

.site-search-close:hover {
  border-color: rgba(37, 99, 235, 0.3);
  background: #eff6ff;
  color: var(--accent);
}

.site-search-close svg,
.search-query-field svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.search-query-field {
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--muted);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-query-field:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  color: var(--accent);
}

.search-query-field svg {
  flex: 0 0 auto;
  margin-left: 12px;
}

.search-query-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 11px 12px 11px 9px;
}

.search-query-input::placeholder {
  color: #98a2b3;
}

.site-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px auto;
  gap: 10px;
}

.site-search-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 12px;
}

.site-search-modal > .notice {
  margin-top: 12px;
}

.site-search-results {
  min-height: 0;
  overflow-y: auto;
  margin-top: 14px;
  padding: 2px 4px 4px 0;
  scrollbar-color: var(--border) transparent;
}

.site-search-results .search-result-group + .search-result-group {
  margin-top: 22px;
}

.site-search-results .search-result-list {
  display: grid;
  gap: 10px;
}

.site-search-results .search-result-card {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  color: var(--text);
  text-decoration: none;
}

.site-search-results .search-result-card:hover,
.site-search-results .search-result-card:focus-visible {
  border-color: var(--accent);
  background: var(--surface-muted);
}

.site-search-modal button:focus-visible,
.site-search-results .search-result-card:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.16);
  outline-offset: 2px;
}

.consent-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.45;
}

.consent-checkbox input {
  margin-top: 3px;
}

.app-modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.58);
  padding: 20px;
}

.app-modal {
  width: min(560px, 100%);
  border: 1px solid rgba(180, 35, 24, 0.35);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  padding: 24px;
}

.app-modal h2 {
  margin: 12px 0 10px;
}

.app-modal p {
  line-height: 1.55;
}

.app-modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

#account-deletion-success {
  margin-bottom: 18px;
}

.app-modal button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 620px) {
  .cookie-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-search-backdrop {
    padding: 12px;
  }

  .site-search-modal {
    height: min(660px, calc(100vh - 24px));
    padding: 18px;
  }

  .site-search-form {
    grid-template-columns: 1fr auto;
  }

  .site-search-form .search-query-field {
    grid-column: 1 / -1;
  }
}

.hidden {
  display: none !important;
}
