:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #07111f;
  --muted: #697586;
  --line: rgba(13, 24, 38, 0.10);
  --primary: #2079ff;
  --primary-2: #33e6a2;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --soft-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius: 26px;
  --radius-sm: 18px;
  --bottom-nav: 92px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05070b;
  --surface: rgba(17, 24, 39, 0.82);
  --surface-strong: #101722;
  --text: #f8fafc;
  --muted: #9aa7b6;
  --line: rgba(255, 255, 255, 0.10);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --soft-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(32, 121, 255, 0.18), transparent 30rem),
    radial-gradient(circle at 80% 5%, rgba(51, 230, 162, 0.14), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.app-content {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(var(--bottom-nav) + env(safe-area-inset-bottom));
}

.desktop-sidebar {
  display: none;
}

.page-fade {
  animation: pageFade 0.34s ease both;
}

@keyframes pageFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.pop-in {
  animation: popIn 0.42s cubic-bezier(.2, .8, .2, 1.2) both;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.pressable {
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.pressable:active {
  transform: scale(0.97);
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 20px;
}

.app-topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(1.8rem, 8vw, 3rem);
  line-height: 1.04;
}

.overline {
  color: var(--primary-2);
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.wave {
  display: inline-block;
  transform-origin: 70% 70%;
  animation: wave 1.4s ease 0.4s 2;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(15deg); }
  55% { transform: rotate(-10deg); }
}

.app-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.hero-workout {
  min-height: 330px;
  margin-bottom: 16px;
  color: #fff;
  background: #07111f;
  box-shadow: var(--shadow);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(145deg, rgba(7, 17, 31, 0.62), rgba(7, 17, 31, 0.94)),
    radial-gradient(circle at 20% 10%, rgba(51, 230, 162, 0.55), transparent 18rem),
    radial-gradient(circle at 85% 25%, rgba(32, 121, 255, 0.65), transparent 18rem);
}

.hero-content {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 24px;
}

.hero-content h2 {
  margin: 28px 0 0;
  max-width: 650px;
  font-size: clamp(2rem, 10vw, 4.6rem);
  line-height: 0.98;
}

.hero-content p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

.section-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.pill,
.status-dot {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.hero-workout .pill,
.hero-workout .status-dot {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.pill.hot {
  background: rgba(51, 230, 162, 0.16);
  color: #a8ffd9;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--warning);
}

.status-dot.active::before {
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(32, 121, 255, 0.16);
}

.status-dot.done::before {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.16);
}

.workout-preview,
.exercise-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workout-preview span,
.exercise-chips span {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  color: inherit;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 750;
}

.exercise-chips span {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--text);
}

.btn-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border-radius: 18px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 900;
  border: 1px solid transparent;
}

.btn-app.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #46a3ff);
  box-shadow: 0 16px 34px rgba(32, 121, 255, 0.32);
}

.btn-app.success {
  width: 100%;
  color: #04110a;
  background: linear-gradient(135deg, var(--primary-2), #90f7c8);
}

.btn-app.ghost {
  width: 100%;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
  border-color: var(--line);
}

.btn-app.compact {
  min-height: 42px;
  border-radius: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card,
.motivation-card,
.cardio-card,
.focus-workout,
.calendar-card,
.profile-hero,
.settings-card,
.app-form {
  padding: 20px;
}

.metric-card span,
.metric-card small,
.workout-count,
.workout-tile p,
.history-item p,
.settings-card p,
.auth-app-card p,
.profile-hero p {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 1.65rem;
  line-height: 1.05;
}

.progress-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 16%, transparent);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 0.38s ease;
}

.progress-track.large {
  height: 14px;
}

.motivation-card,
.cardio-card,
.profile-hero,
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.motivation-card h3,
.cardio-card h3,
.settings-card h2,
.focus-workout h2,
.calendar-card h2,
.profile-hero h2,
.history-item h2,
.workout-tile h2 {
  margin: 4px 0;
}

.spark,
.cardio-ring {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--primary-2) 18%, transparent);
  font-size: 1.8rem;
  font-weight: 950;
}

.cardio-ring {
  color: var(--primary-2);
  border: 8px solid color-mix(in srgb, var(--primary-2) 28%, transparent);
}

.focus-workout {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.exercise-stack {
  display: grid;
  gap: 12px;
}

.exercise-app-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
  opacity: 0.74;
  transition: transform 0.22s ease, opacity 0.22s ease, border 0.22s ease;
}

.exercise-app-card.current {
  opacity: 1;
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 50%, var(--line));
  box-shadow: 0 18px 42px rgba(32, 121, 255, 0.16);
}

.exercise-app-card.next {
  opacity: 0.9;
}

.exercise-app-card.done {
  opacity: 1;
  border-color: color-mix(in srgb, var(--success) 55%, var(--line));
}

.pulse-check {
  animation: pulseCheck 0.42s ease;
}

@keyframes pulseCheck {
  50% { transform: scale(1.02); }
}

.exercise-check {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  cursor: pointer;
  font-weight: 950;
}

.exercise-app-card.done .exercise-check {
  color: #04110a;
  background: var(--primary-2);
}

.exercise-step {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.exercise-app-card h3 {
  margin: 3px 0 10px;
}

.exercise-app-card p {
  margin: 10px 0 0;
  color: var(--muted);
}

.finish-form {
  margin: 0;
}

.success-screen {
  padding: 24px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  color: #04110a;
  background: linear-gradient(135deg, var(--primary-2), #d6ffe8);
  box-shadow: var(--shadow);
}

.success-check {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 26px;
  background: #fff;
  font-size: 2.4rem;
  font-weight: 950;
}

.success-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.success-stats span {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
}

.success-stats strong {
  display: block;
  font-size: 1.15rem;
}

.bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.bottom-nav a {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 58px;
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.bottom-nav a.active {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle,
.round-action {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 18px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: 950;
}

.round-action.logout {
  color: var(--danger);
}

.app-alert {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  font-weight: 850;
}

.app-alert.success {
  color: #064e2f;
  background: #d9fbe8;
}

.app-alert.danger {
  color: #7f1d1d;
  background: #fee2e2;
}

.calendar-strip,
.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
}

.calendar-strip span,
.mini-calendar span {
  display: grid;
  place-items: center;
  min-height: 58px;
  border-radius: 18px;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 8%, transparent);
}

.calendar-strip span.active,
.mini-calendar span.done {
  color: #04110a;
  background: var(--primary-2);
}

.workout-list,
.history-timeline {
  display: grid;
  gap: 12px;
}

.workout-tile {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  padding: 16px;
}

.tile-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 20px;
  color: var(--primary-2);
  background: color-mix(in srgb, var(--primary-2) 14%, transparent);
}

.tile-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tile-actions a {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-weight: 900;
}

.tile-actions a.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.empty-app {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 34px 20px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border-radius: 26px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  font-size: 2rem;
  font-weight: 950;
}

.calendar-card {
  margin-bottom: 16px;
}

.mini-calendar {
  grid-template-columns: repeat(7, 1fr);
  padding: 0;
  margin: 12px 0 0;
}

.history-item {
  justify-content: flex-start;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--primary-2);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary-2) 16%, transparent);
}

.profile-hero {
  justify-content: flex-start;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-size: 2rem;
  font-weight: 950;
}

.theme-switch {
  width: 66px;
  height: 36px;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  cursor: pointer;
}

.theme-switch span {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-strong);
  transition: transform 0.2s ease;
}

:root[data-theme="dark"] .theme-switch span {
  transform: translateX(30px);
}

.app-form {
  display: grid;
  gap: 10px;
}

.app-form label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.app-form input,
.app-form select,
.app-form textarea,
.builder-exercise input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
  outline: none;
  padding: 0 14px;
}

.app-form textarea {
  min-height: 110px;
  padding-top: 14px;
}

.edit-layout {
  display: grid;
  gap: 16px;
}

.exercise-builder {
  padding: 20px;
}

.builder-exercise {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 72%, transparent);
}

.builder-head,
.builder-actions,
.builder-grid {
  display: flex;
  gap: 8px;
}

.builder-head {
  justify-content: space-between;
  align-items: center;
}

.builder-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.drag-pill,
.builder-actions button {
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}

.builder-actions button:last-child {
  color: var(--danger);
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
}

.auth-app-card {
  width: min(100%, 430px);
  padding: 26px;
  border-radius: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.auth-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 950;
}

.auth-app-card h1 {
  margin: 28px 0 10px;
  font-size: 2.2rem;
  line-height: 1;
}

.auth-form {
  padding: 0;
  margin-top: 20px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.auth-link {
  text-align: center;
}

.auth-link a {
  color: var(--primary);
  font-weight: 900;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 18px;
  color: #04110a;
  background: var(--primary-2);
  font-weight: 950;
}

@media (min-width: 920px) {
  .app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
  }

  .desktop-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 24px;
    border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 78%, transparent);
    backdrop-filter: blur(22px);
  }

  .desktop-nav {
    display: grid;
    gap: 8px;
    margin-top: 32px;
  }

  .desktop-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0 14px;
    border-radius: 18px;
    color: var(--muted);
    font-weight: 850;
  }

  .desktop-nav a.active,
  .desktop-nav a:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
  }

  .sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 22px;
  }

  .sidebar-profile small {
    display: block;
    color: var(--muted);
  }

  .avatar {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 18px;
    color: #fff;
    background: var(--primary);
    font-weight: 950;
  }

  .app-content {
    width: min(100%, 1180px);
    padding: 32px;
  }

  .bottom-nav {
    display: none;
  }

  .metric-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .hero-content {
    padding: 34px;
  }

  .workout-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edit-layout {
    grid-template-columns: 0.85fr 1.4fr;
    align-items: start;
  }
}

@media (max-width: 520px) {
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .success-stats {
    grid-template-columns: 1fr;
  }

  .builder-head,
  .builder-actions {
    flex-wrap: wrap;
  }

  .builder-grid {
    grid-template-columns: 1fr;
  }
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

h1 {
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.1;
  word-break: break-word;
}

.admin-responsive-table {
  width: 100%;
  overflow-x: auto;
}

.admin-mobile-list {
  display: none;
}

@media (max-width: 768px) {
  .admin-desktop-table {
    display: none !important;
  }

  .admin-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .admin-mobile-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .admin-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .admin-field .label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
  }

  .admin-field .value {
    font-size: 17px;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
  }

  .admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  .admin-actions button,
  .admin-actions a,
  .admin-actions form {
    flex: 1;
    min-height: 46px;
    border-radius: 999px;
  }
  
  .admin-actions form {
    display: flex;
  }
  
  .admin-actions form button {
      width: 100%;
  }
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.admin-desktop-table {
  display: table;
}

.admin-mobile-list {
  display: none;
}

@media (max-width: 768px) {
  .admin-desktop-table,
  .table-responsive {
    display: none !important;
  }

  .admin-mobile-list {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
  }
}

@media (min-width: 769px) {
  .admin-desktop-table {
    display: table !important;
  }

  .admin-mobile-list {
    display: none !important;
  }
}

/* Admin mobile polish and overflow fixes */
.app-container {
  width: 100%;
  max-width: 100%;
}

.app-page-header {
  margin: 4px 0 18px;
}

.app-page-header h1,
.app-container > h2 {
  max-width: 100%;
  margin: 4px 0 0;
  color: var(--text);
  font-size: clamp(1.85rem, 8vw, 3rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.admin-section-card {
  width: 100%;
  max-width: 100%;
}

.admin-section-card h3 {
  margin: 0 0 18px;
  color: var(--text);
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.12;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.app-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.app-table th,
.app-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.app-table th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.app-table td {
  color: var(--text);
  font-weight: 650;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

.btn-app.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.86rem;
}

.btn-app.secondary {
  background: var(--surface-container, color-mix(in srgb, var(--muted) 12%, transparent));
  color: var(--text);
}

.admin-filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(160px, 1fr)) auto auto;
  gap: 10px;
  align-items: center;
}

.admin-filter-form input,
.admin-filter-form select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 0 16px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.admin-form-grid > div {
  min-width: 0;
}

.admin-mobile-list {
  display: none !important;
}

.admin-mobile-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-soft, var(--soft-shadow));
  padding: 18px;
}

.admin-field {
  display: grid;
  gap: 4px;
}

.admin-field + .admin-field {
  margin-top: 12px;
}

.admin-field .label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-field .value {
  min-width: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.admin-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.admin-actions.stacked,
.admin-actions.single {
  grid-template-columns: 1fr;
}

.admin-actions form,
.admin-actions a,
.admin-actions button {
  width: 100%;
}

@media (max-width: 919px) {
  .app-content {
    width: 100%;
    max-width: 100vw;
    padding: max(16px, env(safe-area-inset-top)) 14px calc(var(--bottom-nav) + 18px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  .app-card {
    border-radius: 24px;
    padding: 18px;
  }

  .admin-desktop-table {
    display: none !important;
  }

  .admin-mobile-list {
    display: grid !important;
    gap: 14px;
  }

  .admin-filter-form {
    grid-template-columns: 1fr;
  }

  .admin-filter-form .btn-app {
    width: 100%;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .app-form input,
  .app-form select,
  .app-form textarea {
    min-width: 0;
    width: 100%;
  }
}

@media (min-width: 920px) {
  .admin-desktop-table {
    display: block !important;
  }

  .admin-mobile-list {
    display: none !important;
  }
}
