/*
 * This shared stylesheet intentionally leans back toward the original
 * LeaderRate prototype: a solid blue header, simple white cards, modest
 * spacing, and straightforward typography. The newer app behavior stays in
 * JavaScript, but the visual shell is kept familiar and easier to extend.
 */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --light: #f8fafc;
  --dark: #1e293b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #e2e8f0;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --header-bg: #2c7da0;
  --header-text: #ffffff;
  --muted: #64748b;
  --radius: 10px;
  --brand-logo-url: url("../images/leaderrate-logo-transparent.png");
}

:root.theme-dark,
body.theme-dark {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #e2e8f0;
  --border: #334155;
  --light: #1e293b;
  --secondary: #94a3b8;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --header-bg: #1e3a5f;
  --header-text: #f1f5f9;
  --muted: #94a3b8;
}

:root.theme-dark {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  width: min(100%, 1200px);
  padding: 0 20px;
}

.site-header {
  background-color: var(--header-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 220;
}

.nav-shell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  padding: 1rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  color: var(--header-text);
  font-weight: 700;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 0;
  background-color: transparent;
  background-image: var(--brand-logo-url);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
  color: transparent;
  font-size: 0;
  letter-spacing: 0;
  overflow: hidden;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.brand-copy [data-app-name],
.brand-copy > span:first-child {
  font-size: 1.45rem;
  font-weight: 700;
}

.brand-copy small {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  font-weight: 500;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--header-text);
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  opacity: 0.82;
  text-decoration: underline;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.nav-actions [data-auth-slot] {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: relative;
}

.desktop-auth-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-actions [data-auth-slot] .btn {
  padding: 0.68rem 1.05rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
}

.theme-toggle,
.mobile-toggle {
  background: none;
  border: none;
  color: var(--header-text);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 999px;
  color: var(--header-text);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.theme-toggle svg {
  width: 1.45rem;
  height: 1.45rem;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle svg circle {
  fill: none;
}

.mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.account-menu-shell {
  position: relative;
}

.account-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: var(--header-text);
  cursor: pointer;
}

.account-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 1.15rem;
}

.account-toggle-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.account-toggle-label {
  white-space: nowrap;
}

.account-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
}

.account-menu-caret {
  font-size: 0.8rem;
  opacity: 0.9;
}

.account-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  min-width: min(220px, calc(100vw - 2rem));
  width: min(280px, calc(100vw - 2rem));
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--card-shadow);
  z-index: 180;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  border: none;
  background: rgba(15, 23, 42, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 180;
}

.mobile-auth-dock {
  display: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.account-menu-header {
  padding: 0.5rem 0.7rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

.account-menu-header strong,
.account-menu-header small {
  display: block;
}

.account-menu-header small {
  color: var(--muted);
  margin-top: 0.15rem;
}

.account-menu-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.7rem;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
}

.account-menu-link:hover {
  background: var(--light);
}

.account-menu-button {
  cursor: pointer;
  color: var(--danger);
  font-weight: 600;
}

.account-menu-button:hover,
.account-menu-button:focus-visible {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.shell-main,
main {
  padding: 2rem 0;
  min-height: calc(100vh - 140px);
}

.page-title {
  margin: 0 0 0.75rem;
  color: var(--dark);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

body.theme-dark .page-title,
body.theme-dark .section-heading h1,
body.theme-dark .section-heading h2 {
  color: #f8fafc;
}

.subtitle,
.muted,
.section-heading p,
.field small,
.stat-label,
.item-meta,
.leader-meta {
  color: var(--muted);
}

.hero,
.panel,
.card,
.form-shell,
.notice,
.stat-card {
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
}

.hero,
.panel,
.card,
.form-shell,
.notice {
  padding: 1.5rem;
}

.hero {
  color: var(--text);
}

.hero h1,
.section-heading h1,
.section-heading h2,
.panel h2,
.card h2,
.card h3 {
  margin-top: 0;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.6rem;
}

.hero-badges,
.button-row,
.toolbar,
.leader-meta,
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button-row {
  margin-top: 1.1rem;
  align-items: center;
}

.section {
  margin-top: 1.75rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.stats-grid,
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.stat-card {
  padding: 1.5rem;
  text-align: center;
}

.stat-number,
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--light);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

.badge.success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.badge.warning {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.badge.danger {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
}

.btn {
  display: inline-block;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, opacity 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
  text-align: center;
  box-shadow: 0 12px 20px -16px rgba(37, 99, 235, 0.7);
}

.btn:hover {
  background-color: var(--primary-dark);
}

.btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.2),
    0 12px 22px -16px rgba(37, 99, 235, 0.75);
}

.btn:active {
  transform: translateY(1px) scale(0.992);
  box-shadow: 0 8px 14px -14px rgba(37, 99, 235, 0.85);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

.btn-secondary {
  background-color: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background-color: var(--light);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  box-shadow: none;
}

.btn-ghost:hover,
.btn-outline:hover {
  background-color: var(--primary);
  color: #fff;
}

.btn-danger {
  background-color: var(--danger);
  box-shadow: 0 12px 20px -16px rgba(239, 68, 68, 0.8);
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-full {
  width: 100%;
}

.btn-small {
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.field label {
  font-weight: 500;
}

.input,
.select,
.textarea,
.search-box,
.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background-color: var(--card-bg);
  color: var(--text);
}

.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.select:-webkit-autofill,
.select:-webkit-autofill:hover,
.select:-webkit-autofill:focus,
.textarea:-webkit-autofill,
.textarea:-webkit-autofill:hover,
.textarea:-webkit-autofill:focus,
.search-box:-webkit-autofill,
.search-box:-webkit-autofill:hover,
.search-box:-webkit-autofill:focus,
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  border: 1px solid var(--border);
  -webkit-box-shadow: 0 0 0 1000px var(--card-bg) inset;
  box-shadow: 0 0 0 1000px var(--card-bg) inset;
  transition: background-color 9999s ease-out 0s;
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.stack {
  display: grid;
  gap: 1rem;
}

.leader-card footer,
.feedback-card footer,
.project-card footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.leader-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.rating {
  font-weight: 700;
  color: var(--primary);
}

.stars {
  color: var(--warning);
  letter-spacing: 0.08em;
}

.feedback-shell-card {
  display: grid;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
}

.feedback-shell-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.9), rgba(37, 99, 235, 0.18));
}

.feedback-shell-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.feedback-shell-title {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.feedback-shell-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.feedback-shell-context {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.feedback-shell-office {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.35;
  color: var(--text);
}

.feedback-shell-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.feedback-shell-rating {
  display: grid;
  gap: 0.18rem;
  justify-items: end;
  align-content: start;
  min-width: 6rem;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02));
}

.feedback-shell-score {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.12rem;
  color: var(--text);
}

.feedback-shell-score strong {
  font-size: 1.45rem;
  line-height: 1;
}

.feedback-shell-score span {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.feedback-shell-rating .stars {
  font-size: 0.92rem;
}

.feedback-shell-message {
  margin: 0;
  color: var(--text);
  line-height: 1.68;
}

.feedback-shell-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.feedback-shell-support {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.6rem 0.78rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 700;
}

.feedback-shell-support strong {
  font-size: 1.02rem;
  color: var(--text);
}

.feedback-shell-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.project-shell-card {
  display: grid;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
}

.project-shell-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, rgba(14, 116, 144, 0.9), rgba(14, 116, 144, 0.16));
}

.project-shell-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.project-shell-title {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.project-shell-kicker,
.project-shell-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
}

.project-shell-copy {
  margin: 0;
  color: var(--text);
  line-height: 1.68;
}

.project-shell-support {
  display: grid;
  gap: 0.15rem;
  justify-items: end;
  align-content: start;
  min-width: 5.6rem;
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.1), rgba(14, 116, 144, 0.02));
  border: 1px solid rgba(14, 116, 144, 0.14);
}

.project-shell-support strong {
  font-size: 1.28rem;
  line-height: 1;
  color: var(--text);
}

.project-shell-support span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.project-shell-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.response-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  background-color: var(--light);
}

.empty-state {
  padding: 1.5rem;
  text-align: center;
}

.search-container {
  margin-bottom: 1.5rem;
}

.filters-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-footer {
  background-color: var(--dark);
  color: white;
  padding: 2.4rem 0 2rem;
  margin-top: 2.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-shell,
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.footer-logo::before {
  content: "";
  width: 2.9rem;
  height: 2.9rem;
  flex: 0 0 2.9rem;
  border-radius: 0;
  background-color: transparent;
  background-image: var(--brand-logo-url);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: none;
}

.footer-brand-group {
  display: grid;
  gap: 0.55rem;
  flex: 1 1 320px;
  min-width: 0;
}

.footer-note {
  margin: 0;
  max-width: none;
  color: rgba(255, 255, 255, 0.74);
  font-size: 1rem;
  line-height: 1.6;
  white-space: normal;
}

.footer-side {
  margin-left: auto;
  display: grid;
  justify-items: end;
  gap: 1rem;
  flex: 1 1 520px;
  min-width: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem 1.4rem;
  max-width: 100%;
  white-space: normal;
}

.footer-links a {
  color: white;
  font-weight: 500;
  opacity: 0.94;
}

.footer-links a:hover {
  color: #bfdbfe;
}

.footer-legal {
  color: rgba(255, 255, 255, 0.44);
  font-size: 0.98rem;
  text-align: right;
  white-space: normal;
}

.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: grid;
  gap: 0.75rem;
}

.toast {
  min-width: 250px;
  max-width: 360px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  box-shadow: var(--card-shadow);
}

.toast.info {
  background: var(--primary);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.app-banner {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #92400e;
}

.hidden {
  display: none !important;
}

.table-state {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
}

.quick-actions,
.leaderboard-preview {
  margin-top: 2rem;
}

.action-card {
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  text-align: center;
  color: inherit;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.action-card h3 {
  color: var(--primary);
  margin-bottom: 0.4rem;
}

@media (max-width: 920px) {
  .grid.two,
  .grid.three,
  .split {
    grid-template-columns: 1fr;
  }

  .nav-shell {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .nav-links {
    position: fixed;
    top: 5rem;
    right: 20px;
    width: min(320px, calc(100vw - 40px));
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.95rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 24px 55px -30px rgba(15, 23, 42, 0.52);
    transform: translateX(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
    z-index: 230;
  }

  .nav-links a {
    color: var(--text);
    padding: 0.82rem 0.9rem;
    border-radius: 12px;
    font-weight: 600;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: var(--light);
    color: var(--primary);
    opacity: 1;
    text-decoration: none;
  }

  .nav-links.mobile-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-backdrop.mobile-open {
    opacity: 1;
    pointer-events: auto;
  }

  .nav-actions {
    justify-content: flex-end;
    gap: 0.65rem;
    margin-left: auto;
  }

  .nav-actions [data-auth-slot] {
    justify-content: flex-end;
  }

  .nav-actions [data-auth-slot].profile-auth-slot {
    flex-wrap: nowrap;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  body.mobile-menu-open .mobile-auth-dock {
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 18px;
  }

  .site-header {
    padding-top: 0;
    background-color: var(--header-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .site-header .container {
    padding: 10px 18px;
  }

  .hero,
  .panel,
  .card,
  .form-shell,
  .notice,
  .stat-card {
    padding: 1rem;
  }

  .brand {
    flex: 1 1 auto;
    gap: 0.65rem;
  }

  .brand-copy [data-app-name],
  .brand-copy > span:first-child {
    font-size: 1.08rem;
    line-height: 1.1;
  }

  .brand-copy small {
    font-size: 0.76rem;
    line-height: 1.1;
  }

  .brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    font-size: 1.05rem;
  }

  .nav-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    padding: 1.28rem 0;
  }

  .nav-links {
    top: 4.65rem;
    right: 24px;
    width: min(300px, calc(100vw - 48px));
    max-height: calc(100vh - 5.65rem);
    padding: 0.85rem;
    gap: 0.3rem;
  }

  .nav-links a {
    font-size: 0.94rem;
  }

  .nav-actions {
    grid-column: 2;
    display: grid;
    grid-template-columns: 2.5rem auto;
    align-items: center;
    align-content: start;
    justify-content: end;
    column-gap: 0.45rem;
    row-gap: 0.55rem;
    margin-left: 0;
    width: auto;
  }

  .nav-actions.has-profile-auth {
    grid-template-columns: 2.5rem auto 2.5rem;
  }

  .nav-actions [data-auth-slot] {
    grid-column: 1 / -1;
    flex: 1 0 100%;
    gap: 0.55rem;
    justify-content: flex-end;
    margin-left: 0;
  }

  .nav-actions [data-auth-slot].guest-auth-slot {
    display: none;
  }

  .nav-actions [data-auth-slot].profile-auth-slot {
    grid-column: auto;
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 2.5rem;
    justify-content: flex-end;
  }

  .nav-actions [data-auth-slot] .btn,
  .account-menu-toggle,
  .mobile-toggle {
    min-height: 2.5rem;
    padding: 0.64rem 1rem;
    font-size: 0.92rem;
  }

  .theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
  }

  .theme-toggle svg {
    width: 1.34rem;
    height: 1.34rem;
  }

  .mobile-toggle {
    min-width: 4.4rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
  }

  .account-menu-shell {
    display: flex;
  }

  .account-menu-toggle {
    width: 2.5rem;
    justify-content: center;
    padding: 0;
    gap: 0;
  }

  .account-toggle-label,
  .account-menu-caret {
    display: none;
  }

  .nav-actions [data-auth-slot] .btn {
    flex: 0 1 auto;
  }

  .mobile-auth-dock {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    padding: 0.7rem;
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(16px);
    z-index: 150;
  }

  body.theme-dark .mobile-auth-dock {
    border-color: rgba(51, 65, 85, 0.95);
    background: rgba(15, 23, 42, 0.92);
  }

  .mobile-auth-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0.7rem 1rem;
    border-radius: 14px;
    font-weight: 700;
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
  }

  .mobile-auth-link:hover {
    transform: translateY(-1px);
  }

  .mobile-auth-link-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
  }

  .mobile-auth-link-primary {
    background: var(--primary);
    color: #fff;
  }

  .mobile-auth-link.is-active {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.16);
  }

  body.has-mobile-auth-dock .shell-main,
  body.has-mobile-auth-dock main {
    padding-bottom: 5.5rem;
  }

  body.has-mobile-auth-dock .site-footer {
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
  }

  body.has-mobile-auth-dock .footer-links a[href="login.html"],
  body.has-mobile-auth-dock .footer-links a[href="register.html"] {
    display: none;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-heading > .btn,
  .section-heading > a.btn,
  .section-heading > button.btn {
    width: 100%;
  }

  .footer-shell,
  .footer-content {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 1.25rem;
  }

  .leader-actions,
  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .feedback-shell-head {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .project-shell-head {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .feedback-shell-rating {
    justify-items: start;
    min-width: 0;
  }

  .project-shell-support {
    justify-items: start;
    min-width: 0;
  }

  .feedback-shell-score {
    justify-content: flex-start;
  }

  .feedback-shell-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .project-shell-actions {
    justify-content: stretch;
  }

  .stats-grid,
  .stats-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }

  .stat-card {
    min-width: 0;
    padding: 1rem 0.85rem;
  }

  .button-row .btn,
  .leader-actions .btn,
  .leader-actions a,
  .leader-actions button {
    width: 100%;
  }

  .footer-note {
    white-space: normal;
  }

  .footer-side {
    margin-left: 0;
    justify-items: start;
  }

  .footer-links {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
    gap: 0.7rem 1.15rem;
  }

  .footer-legal {
    text-align: left;
    white-space: normal;
  }

  .toast-stack {
    left: 15px;
    right: 15px;
    top: 15px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .site-header .container {
    padding: 10px 16px;
  }

  .nav-shell {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    padding: 1.2rem 0;
  }

  .brand-copy [data-app-name],
  .brand-copy > span:first-child {
    font-size: 1.04rem;
    line-height: 1.1;
  }

  .brand-copy small {
    font-size: 0.74rem;
    line-height: 1.1;
  }

  .brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.05rem;
  }

  .nav-actions {
    width: auto;
  }

  .nav-actions [data-auth-slot] {
    flex: 1 0 100%;
    gap: 0.45rem;
  }

  .nav-actions [data-auth-slot].profile-auth-slot {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 2.5rem;
  }

  .nav-links {
    top: 4.35rem;
    right: 22px;
    width: min(280px, calc(100vw - 44px));
    max-height: calc(100vh - 5.15rem);
  }

  .nav-actions [data-auth-slot] .btn,
  .account-menu-toggle {
    min-height: 2.5rem;
    padding: 0.64rem 0.96rem;
    font-size: 0.9rem;
  }

  .account-menu-toggle {
    width: 2.5rem;
    justify-content: center;
    padding: 0;
  }

  .theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
  }

  .theme-toggle svg {
    width: 1.34rem;
    height: 1.34rem;
  }

  .mobile-toggle {
    min-width: 4.15rem;
    min-height: 2.5rem;
    padding-inline: 0.8rem;
  }

  .mobile-auth-dock {
    left: 14px;
    right: 14px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    gap: 0.55rem;
    padding: 0.55rem;
  }
}

@media (max-width: 360px) {
  .container {
    padding: 0 12px;
  }

  .site-header .container {
    padding: 8px 12px;
  }

  .nav-shell {
    gap: 0.45rem;
    padding: 1rem 0;
  }

  .brand {
    gap: 0.4rem;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
  }

  .brand-copy [data-app-name],
  .brand-copy > span:first-child {
    font-size: 0.88rem;
    line-height: 1.04;
  }

  .brand-copy small {
    display: block;
    max-width: 5.3rem;
    font-size: 0.6rem;
    line-height: 1.02;
  }

  .nav-actions {
    grid-template-columns: 2.2rem auto;
    column-gap: 0.35rem;
  }

  .nav-actions.has-profile-auth {
    grid-template-columns: 2.2rem auto 2.2rem;
  }

  .theme-toggle,
  .account-menu-toggle {
    width: 2.2rem;
    height: 2.2rem;
    min-height: 2.2rem;
  }

  .theme-toggle svg,
  .account-toggle-icon {
    width: 1.18rem;
    height: 1.18rem;
  }

  .nav-actions [data-auth-slot].profile-auth-slot {
    min-width: 2.2rem;
  }

  .mobile-toggle {
    min-width: 3.45rem;
    min-height: 2.2rem;
    padding-inline: 0.55rem;
    font-size: 0.8rem;
  }

  .nav-links {
    top: 4rem;
    right: 18px;
    width: min(260px, calc(100vw - 36px));
    max-height: calc(100vh - 4.8rem);
  }
}
