/* Shared mobile-app treatment for legacy LIFF pages. */
:root {
  --mobile-app-bg: #f5f0ff;
  --mobile-app-surface: #ffffff;
  --mobile-app-text: #0f172a;
  --mobile-app-muted: #64748b;
  --mobile-app-border: rgba(15, 23, 42, 0.1);
  --mobile-app-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --mobile-app-primary: #7c3aed;
  --mobile-app-primary-dark: #4c1d95;
  --mobile-app-primary-soft: #f3e8ff;
  --mobile-app-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  background: var(--mobile-app-bg);
}

body.legacy-mobile-app {
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(168, 85, 247, 0.16), transparent 32rem),
    linear-gradient(180deg, #ffffff 0%, var(--mobile-app-bg) 48%, #f8f5ff 100%) !important;
  color: var(--mobile-app-text);
  -webkit-tap-highlight-color: transparent;
}

body.legacy-mobile-app button,
body.legacy-mobile-app input,
body.legacy-mobile-app select,
body.legacy-mobile-app textarea,
body.legacy-mobile-app .btn {
  min-height: 44px;
  font-size: 16px;
  touch-action: manipulation;
}

body.legacy-mobile-app button,
body.legacy-mobile-app a,
body.legacy-mobile-app summary,
body.legacy-mobile-app label[for] {
  touch-action: manipulation;
}

body.legacy-mobile-app img,
body.legacy-mobile-app video,
body.legacy-mobile-app iframe {
  max-width: 100%;
}

body.legacy-mobile-app > header,
body.legacy-mobile-app .app-mobile-header {
  padding-top: max(0px, env(safe-area-inset-top, 0px));
  backdrop-filter: blur(16px);
}

body.legacy-mobile-app main,
body.legacy-mobile-app .container,
body.legacy-mobile-app .container-fluid {
  position: relative;
}

body.legacy-mobile-app .card,
body.legacy-mobile-app .rounded-lg,
body.legacy-mobile-app .rounded-xl,
body.legacy-mobile-app .shadow,
body.legacy-mobile-app .shadow-lg,
body.legacy-mobile-app .shadow-md {
  border-color: var(--mobile-app-border);
}

body.legacy-mobile-app .mobile-audit-hidden {
  display: none !important;
}

body.legacy-mobile-app .mobile-app-safe-bottom {
  padding-bottom: calc(1rem + var(--mobile-app-safe-bottom));
}

body.legacy-mobile-app.has-mobile-app-topbar {
  padding-top: 0 !important;
}

body.legacy-mobile-app .mobile-app-topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 35 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-sizing: border-box;
  gap: 0.75rem;
  width: 100% !important;
  max-width: 100% !important;
  min-height: calc(4rem + env(safe-area-inset-top, 0px));
  margin: 0 !important;
  padding: calc(0.7rem + env(safe-area-inset-top, 0px)) 0.85rem 0.7rem;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
}

body.legacy-mobile-app .mobile-app-topbar,
body.legacy-mobile-app .mobile-app-topbar * {
  box-sizing: border-box;
}

body.legacy-mobile-app .mobile-app-topbar-brand {
  display: inline-flex !important;
  align-items: center !important;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.65rem;
  color: #172033;
  text-decoration: none;
}

body.legacy-mobile-app .mobile-app-topbar-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  border-radius: 0.8rem;
  background: #ffffff;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

body.legacy-mobile-app .mobile-app-topbar-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.legacy-mobile-app .mobile-app-topbar-brand > span:last-child {
  min-width: 0;
}

body.legacy-mobile-app .mobile-app-topbar-brand strong,
body.legacy-mobile-app .mobile-app-topbar-brand small {
  display: block;
}

body.legacy-mobile-app .mobile-app-topbar-brand strong {
  max-width: 42vw;
  overflow: hidden;
  line-height: 1.1;
  color: #172033;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.legacy-mobile-app .mobile-app-topbar-brand small {
  max-width: 42vw;
  overflow: hidden;
  color: #667085;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.legacy-mobile-app .mobile-app-topbar-actions {
  position: relative;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-width: 0;
}

body.legacy-mobile-app .mobile-app-topbar-icon-btn,
body.legacy-mobile-app .mobile-app-topbar-menu summary,
body.legacy-mobile-app .mobile-app-topbar-language {
  min-height: 2.25rem;
  border: 1px solid #d7dce6;
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
}

body.legacy-mobile-app .mobile-app-topbar-icon-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0 0.55rem;
}

body.legacy-mobile-app .mobile-app-topbar-language {
  width: auto !important;
  max-width: 4.6rem;
  padding: 0 0.55rem;
}

body.legacy-mobile-app .mobile-app-topbar-menu {
  position: relative;
}

body.legacy-mobile-app .mobile-app-topbar-menu summary {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 4.25rem;
  padding: 0 0.8rem;
  list-style: none;
  cursor: pointer;
}

body.legacy-mobile-app .mobile-app-topbar-menu summary::-webkit-details-marker {
  display: none;
}

body.legacy-mobile-app .mobile-app-topbar-menu-panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: min(88vw, 22rem);
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.18);
}

body.legacy-mobile-app .mobile-app-topbar-profile {
  display: grid;
  gap: 0.15rem;
  padding: 1rem;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
}

body.legacy-mobile-app .mobile-app-topbar-profile span {
  color: #667085;
  font-size: 0.8rem;
}

body.legacy-mobile-app .mobile-app-topbar-menu-list {
  display: grid;
  gap: 0.35rem;
  padding: 0.6rem;
}

body.legacy-mobile-app .mobile-app-topbar-menu-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 3rem;
  border-radius: 0.8rem;
  padding: 0.65rem 0.75rem;
  color: #1f2937;
  text-decoration: none;
}

body.legacy-mobile-app .mobile-app-topbar-menu-link:active,
body.legacy-mobile-app .mobile-app-topbar-menu-link:hover {
  background: #f3f6fb;
}

body.legacy-mobile-app .mobile-app-topbar-menu-link span {
  width: 1.5rem;
  text-align: center;
}

body.legacy-mobile-app .mobile-app-legacy-clear-control,
body.legacy-mobile-app .mobile-app-legacy-language-control,
body.legacy-mobile-app .mobile-app-legacy-nav-control {
  display: none !important;
}

body.legacy-mobile-app.has-mobile-app-bottom-nav {
  padding-bottom: calc(5rem + var(--mobile-app-safe-bottom)) !important;
}

body.legacy-mobile-app .mobile-app-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.08);
  padding: 0 0 var(--mobile-app-safe-bottom);
  backdrop-filter: blur(12px);
}

body.legacy-mobile-app .mobile-app-bottom-nav a {
  display: grid;
  place-items: center;
  gap: 0.15rem;
  min-width: 0;
  min-height: 3.95rem;
  padding: 0.45rem 0.2rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  border-radius: 0;
}

body.legacy-mobile-app .mobile-app-bottom-nav .nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

body.legacy-mobile-app .mobile-app-bottom-nav .nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.legacy-mobile-app .mobile-app-bottom-nav a.active,
body.legacy-mobile-app .mobile-app-bottom-nav a:hover,
body.legacy-mobile-app .mobile-app-bottom-nav a:focus-visible {
  color: var(--mobile-app-primary);
  font-weight: 800;
}

body.legacy-mobile-app .mobile-app-page-header {
  position: relative;
  color: #ffffff;
}

body.legacy-mobile-app .mobile-app-page-header,
body.legacy-mobile-app .mobile-app-page-header * {
  color: #ffffff;
}

body.legacy-mobile-app .mobile-app-page-header a,
body.legacy-mobile-app .mobile-app-page-header #profile-name,
body.legacy-mobile-app .mobile-app-page-header [id*="profile"],
body.legacy-mobile-app .mobile-app-page-header [class*="profile"] {
  color: #ffffff !important;
}

body.legacy-mobile-app .mobile-app-page-header small,
body.legacy-mobile-app .mobile-app-page-header #profile-role,
body.legacy-mobile-app .mobile-app-page-header .text-gray-400,
body.legacy-mobile-app .mobile-app-page-header .text-gray-500,
body.legacy-mobile-app .mobile-app-page-header .text-gray-600 {
  color: rgba(255, 255, 255, 0.72) !important;
}

body.legacy-mobile-app .mobile-app-page-header h1,
body.legacy-mobile-app .mobile-app-page-header h2,
body.legacy-mobile-app .mobile-app-page-header h3 {
  font-size: clamp(1.35rem, 5.8vw, 2rem) !important;
  line-height: 1.12;
  max-width: 100%;
  overflow-wrap: anywhere;
}

body.legacy-mobile-app .mobile-app-page-header:has(#user-profile) h1,
body.legacy-mobile-app .mobile-app-page-header:has(#user-profile) h2,
body.legacy-mobile-app .mobile-app-page-header:has(#user-profile) h3 {
  padding-right: min(42vw, 12rem);
}

body.legacy-mobile-app .mobile-app-page-header #user-profile {
  position: absolute !important;
  top: calc(0.85rem + env(safe-area-inset-top, 0px));
  right: 1rem;
  z-index: 2;
  display: block !important;
  max-width: min(38vw, 11rem);
  min-width: 0;
  text-align: right !important;
}

body.legacy-mobile-app .mobile-app-page-header #profile-name,
body.legacy-mobile-app .mobile-app-page-header #profile-role {
  display: block;
  max-width: 100%;
  overflow: hidden;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.legacy-mobile-app .mobile-app-page-header #profile-name {
  font-size: clamp(0.68rem, 2.7vw, 0.9rem) !important;
  font-weight: 900 !important;
}

body.legacy-mobile-app .mobile-app-page-header #profile-role {
  margin-top: 0.15rem;
  font-size: clamp(0.58rem, 2.25vw, 0.76rem) !important;
  font-weight: 700;
}

body.legacy-mobile-app .mobile-app-page-header select,
body.legacy-mobile-app .mobile-app-page-header select *,
body.legacy-mobile-app .mobile-app-page-header option {
  color: #111827 !important;
}

body.legacy-mobile-app .mobile-app-page-body {
  width: min(1120px, 100%);
  margin-left: auto;
  margin-right: auto;
}

body.legacy-mobile-app .mobile-app-surface {
  border: 1px solid var(--mobile-app-border);
  background-color: rgba(255, 255, 255, 0.96);
}

body.legacy-mobile-app .mobile-app-form label,
body.legacy-mobile-app .form-label,
body.legacy-mobile-app label.block {
  color: #334155;
  font-weight: 700;
}

body.legacy-mobile-app .mobile-app-action {
  -webkit-user-select: none;
  user-select: none;
}

@media (max-width: 767px) {
  body.legacy-mobile-app {
    padding-bottom: calc(1rem + var(--mobile-app-safe-bottom));
  }

  body.legacy-mobile-app > header {
    position: relative;
    top: auto;
    z-index: 30;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  }

  body.legacy-mobile-app .mobile-app-page-header {
    margin: 0 0 1rem;
    padding: calc(0.8rem + env(safe-area-inset-top, 0px)) 1rem 1rem !important;
    border-radius: 0 0 1.5rem 1.5rem;
    background:
      radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.22), transparent 12rem),
      linear-gradient(135deg, #4c1d95 0%, #7c3aed 52%, #a855f7 100%) !important;
  }

  body.legacy-mobile-app .mobile-app-page-header > *,
  body.legacy-mobile-app .mobile-app-page-header > .container,
  body.legacy-mobile-app .mobile-app-page-header > .container-fluid,
  body.legacy-mobile-app .mobile-app-page-header > div {
    width: 100%;
    max-width: 100%;
  }

  body.legacy-mobile-app .mobile-app-page-header h1,
  body.legacy-mobile-app .mobile-app-page-header h2,
  body.legacy-mobile-app .mobile-app-page-header h3 {
    color: #ffffff !important;
    font-size: clamp(1.35rem, 7vw, 1.95rem) !important;
    overflow-wrap: anywhere;
  }

  body.legacy-mobile-app .mobile-app-page-header:has(#user-profile) {
    min-height: 8.35rem;
  }

  body.legacy-mobile-app .mobile-app-page-header:has(#user-profile) h1,
  body.legacy-mobile-app .mobile-app-page-header:has(#user-profile) h2,
  body.legacy-mobile-app .mobile-app-page-header:has(#user-profile) h3 {
    padding-right: min(45vw, 11rem);
  }

  body.legacy-mobile-app .mobile-app-page-header #user-profile {
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    right: 1rem;
    max-width: min(39vw, 10rem);
  }

  body.legacy-mobile-app .mobile-app-page-header select,
  body.legacy-mobile-app .mobile-app-page-header button,
  body.legacy-mobile-app .mobile-app-page-header a {
    flex: 0 0 auto;
  }

  body.legacy-mobile-app .mobile-app-page-header .flex,
  body.legacy-mobile-app .mobile-app-page-header .d-flex {
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }

  body.legacy-mobile-app .mobile-app-page-header .flex:has(a, button),
  body.legacy-mobile-app .mobile-app-page-header .d-flex:has(a, button),
  body.legacy-mobile-app .mobile-app-card-header .flex:has(a, button),
  body.legacy-mobile-app .mobile-app-card-header .d-flex:has(a, button),
  body.legacy-mobile-app .card-header .flex:has(a, button),
  body.legacy-mobile-app .card-header .d-flex:has(a, button) {
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100%;
  }

  body.legacy-mobile-app .mobile-app-page-header a:not(.mobile-app-topbar-brand),
  body.legacy-mobile-app .mobile-app-page-header button:not(.mobile-app-topbar-icon-btn),
  body.legacy-mobile-app .mobile-app-card-header a,
  body.legacy-mobile-app .mobile-app-card-header button,
  body.legacy-mobile-app .card-header a,
  body.legacy-mobile-app .card-header button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0;
    min-height: 44px;
    max-width: 100%;
    padding: 0.6rem 0.95rem !important;
    border: 1px solid rgba(255, 255, 255, 0.72) !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    color: var(--mobile-app-primary-dark) !important;
    box-shadow: 0 10px 22px rgba(76, 29, 149, 0.18);
    font-size: 0.86rem !important;
    font-weight: 800 !important;
    line-height: 1.1;
    text-align: center;
    text-decoration: none !important;
    white-space: normal;
  }

  body.legacy-mobile-app .mobile-app-page-header a:not(.mobile-app-topbar-brand):hover,
  body.legacy-mobile-app .mobile-app-page-header button:not(.mobile-app-topbar-icon-btn):hover,
  body.legacy-mobile-app .mobile-app-card-header a:hover,
  body.legacy-mobile-app .mobile-app-card-header button:hover,
  body.legacy-mobile-app .card-header a:hover,
  body.legacy-mobile-app .card-header button:hover {
    background: #ffffff !important;
    color: #6d28d9 !important;
  }

  body.legacy-mobile-app .mobile-app-page-header a:not(.mobile-app-topbar-brand) *,
  body.legacy-mobile-app .mobile-app-page-header button:not(.mobile-app-topbar-icon-btn) *,
  body.legacy-mobile-app .mobile-app-card-header a *,
  body.legacy-mobile-app .mobile-app-card-header button *,
  body.legacy-mobile-app .card-header a *,
  body.legacy-mobile-app .card-header button * {
    color: inherit !important;
  }

  body.legacy-mobile-app > header > .container,
  body.legacy-mobile-app > header > .container-fluid,
  body.legacy-mobile-app > main,
  body.legacy-mobile-app > .container,
  body.legacy-mobile-app > .container-fluid,
  body.legacy-mobile-app main.container,
  body.legacy-mobile-app main.container-fluid {
    width: 100%;
    max-width: 100%;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  body.legacy-mobile-app .mobile-app-page-body {
    padding-top: 0 !important;
    padding-bottom: calc(5rem + var(--mobile-app-safe-bottom)) !important;
  }

  body.legacy-mobile-app h1,
  body.legacy-mobile-app h2,
  body.legacy-mobile-app h3,
  body.legacy-mobile-app h4 {
    line-height: 1.2;
  }

  body.legacy-mobile-app h1 {
    font-size: clamp(1.25rem, 7vw, 1.75rem) !important;
  }

  body.legacy-mobile-app .card,
  body.legacy-mobile-app .bg-white,
  body.legacy-mobile-app .register-card {
    border-radius: 1.25rem !important;
  }

  body.legacy-mobile-app .mobile-app-surface {
    border-radius: 1.35rem !important;
    box-shadow: var(--mobile-app-shadow) !important;
    overflow: hidden;
  }

  body.legacy-mobile-app .card,
  body.legacy-mobile-app .register-card,
  body.legacy-mobile-app main > .bg-white,
  body.legacy-mobile-app main .shadow-lg,
  body.legacy-mobile-app main .shadow-md {
    box-shadow: var(--mobile-app-shadow) !important;
  }

  body.legacy-mobile-app .card-header,
  body.legacy-mobile-app header[class*="bg-gradient"],
  body.legacy-mobile-app header[class*="bg-primary"],
  body.legacy-mobile-app header[class*="bg-white"] {
    border-radius: 0 0 1.5rem 1.5rem;
  }

  body.legacy-mobile-app .mobile-app-card-header,
  body.legacy-mobile-app .card-header {
    padding: 1rem !important;
    border: 0 !important;
    background:
      radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.22), transparent 12rem),
      linear-gradient(135deg, #4c1d95 0%, #7c3aed 52%, #a855f7 100%) !important;
    color: #ffffff !important;
  }

  body.legacy-mobile-app .mobile-app-topbar {
    min-height: calc(3.75rem + env(safe-area-inset-top, 0px));
    padding: calc(0.55rem + env(safe-area-inset-top, 0px)) 0.75rem 0.55rem;
  }

  body.legacy-mobile-app .mobile-app-topbar-brand {
    gap: 0.55rem;
  }

  body.legacy-mobile-app .mobile-app-topbar-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.7rem;
  }

  body.legacy-mobile-app .mobile-app-topbar-brand strong {
    max-width: 34vw;
    font-size: 0.92rem;
  }

  body.legacy-mobile-app .mobile-app-topbar-brand small {
    max-width: 34vw;
    font-size: 0.66rem;
  }

  body.legacy-mobile-app .mobile-app-topbar-actions {
    gap: 0.3rem;
  }

  body.legacy-mobile-app .mobile-app-topbar-icon-btn,
  body.legacy-mobile-app .mobile-app-topbar-menu summary,
  body.legacy-mobile-app .mobile-app-topbar-language {
    min-height: 2.1rem;
    font-size: 0.76rem;
  }

  body.legacy-mobile-app .mobile-app-topbar-language {
    max-width: 4.25rem;
    padding: 0 0.45rem;
  }

  body.legacy-mobile-app .mobile-app-topbar-menu summary {
    min-width: 3.75rem;
    padding: 0 0.65rem;
  }

  body.legacy-mobile-app .mobile-app-card-header h1,
  body.legacy-mobile-app .mobile-app-card-header h2,
  body.legacy-mobile-app .mobile-app-card-header h3,
  body.legacy-mobile-app .mobile-app-card-header h4,
  body.legacy-mobile-app .card-header h1,
  body.legacy-mobile-app .card-header h2,
  body.legacy-mobile-app .card-header h3,
  body.legacy-mobile-app .card-header h4 {
    color: #ffffff !important;
    font-size: clamp(1.15rem, 5.5vw, 1.45rem) !important;
  }

  body.legacy-mobile-app .row {
    --bs-gutter-x: 1rem;
  }

  body.legacy-mobile-app .d-flex,
  body.legacy-mobile-app .flex {
    min-width: 0;
  }

  body.legacy-mobile-app .btn,
  body.legacy-mobile-app button,
  body.legacy-mobile-app a[class*="btn"],
  body.legacy-mobile-app [role="button"] {
    border-radius: 0.9rem;
  }

  body.legacy-mobile-app .mobile-app-action {
    min-height: 44px;
    align-items: center;
  }

  body.legacy-mobile-app .mobile-app-form {
    display: grid;
    gap: 0.9rem;
  }

  body.legacy-mobile-app .mobile-app-form .mb-3,
  body.legacy-mobile-app .mobile-app-form .mb-4 {
    margin-bottom: 0 !important;
  }

  body.legacy-mobile-app input:not([type="checkbox"]):not([type="radio"]),
  body.legacy-mobile-app select,
  body.legacy-mobile-app textarea,
  body.legacy-mobile-app .form-control,
  body.legacy-mobile-app .form-select {
    width: 100%;
    border-radius: 0.9rem !important;
  }

  body.legacy-mobile-app .mobile-app-page-header select,
  body.legacy-mobile-app .card-header select {
    width: auto !important;
    max-width: 48vw;
  }

  body.legacy-mobile-app input[type="file"] {
    min-height: 48px;
  }

  body.legacy-mobile-app .input-group {
    align-items: stretch;
  }

  body.legacy-mobile-app .input-group > .btn,
  body.legacy-mobile-app .input-group > .input-group-text {
    min-height: 44px;
    border-radius: 0.9rem !important;
  }

  body.legacy-mobile-app .table-responsive,
  body.legacy-mobile-app .table-responsive-container,
  body.legacy-mobile-app .overflow-x-auto {
    overflow-x: visible !important;
  }

  body.legacy-mobile-app table.mobile-card-table,
  body.legacy-mobile-app table.mobile-card-table tbody,
  body.legacy-mobile-app table.mobile-card-table tr,
  body.legacy-mobile-app table.mobile-card-table td {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  body.legacy-mobile-app table.mobile-card-table {
    border-collapse: separate;
    border-spacing: 0;
  }

  body.legacy-mobile-app table.mobile-card-table thead,
  body.legacy-mobile-app table.mobile-card-table tfoot {
    display: none;
  }

  body.legacy-mobile-app table.mobile-card-table tbody {
    display: grid;
    gap: 0.85rem;
    background: transparent !important;
  }

  body.legacy-mobile-app table.mobile-card-table tr {
    border: 1px solid var(--mobile-app-border);
    border-radius: 1.25rem;
    background: var(--mobile-app-surface);
    box-shadow: var(--mobile-app-shadow);
    padding: 0.85rem;
  }

  body.legacy-mobile-app table.mobile-card-table td {
    border: 0 !important;
    padding: 0.45rem 0 !important;
    color: #172033;
    font-size: 0.9rem;
    line-height: 1.45;
    text-align: left !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
    word-break: break-word;
  }

  body.legacy-mobile-app table.mobile-card-table td:not(:last-child) {
    display: grid;
    grid-template-columns: minmax(6.25rem, 38%) minmax(0, 1fr);
    align-items: flex-start;
    gap: 0.35rem 0.75rem;
  }

  body.legacy-mobile-app table.mobile-card-table td::before {
    content: attr(data-label);
    min-width: 0;
    max-width: none;
    color: var(--mobile-app-muted);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  body.legacy-mobile-app table.mobile-card-table td > * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  body.legacy-mobile-app table.mobile-card-table td[data-label=""]::before,
  body.legacy-mobile-app table.mobile-card-table td:not([data-label])::before {
    display: none;
  }

  body.legacy-mobile-app table.mobile-card-table td:last-child {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-top: 1px solid #eef2f7 !important;
    margin-top: 0.45rem;
    padding-top: 0.8rem !important;
    text-align: center !important;
  }

  body.legacy-mobile-app table.mobile-card-table td:last-child::before {
    display: none;
  }

  body.legacy-mobile-app table.mobile-card-table td:last-child button,
  body.legacy-mobile-app table.mobile-card-table td:last-child a,
  body.legacy-mobile-app table.mobile-card-table td:last-child .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 7rem;
    margin: 0;
    padding: 0.6rem 0.85rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }

  body.legacy-mobile-app table.mobile-card-table td:last-child button[class*="bg-blue-"],
  body.legacy-mobile-app table.mobile-card-table td:last-child a[class*="bg-blue-"],
  body.legacy-mobile-app table.mobile-card-table td:last-child .btn[class*="bg-blue-"] {
    background: #2563eb !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
  }

  body.legacy-mobile-app table.mobile-card-table td:last-child button[class*="bg-green-"],
  body.legacy-mobile-app table.mobile-card-table td:last-child a[class*="bg-green-"],
  body.legacy-mobile-app table.mobile-card-table td:last-child .btn[class*="bg-green-"] {
    background: #16a34a !important;
    border-color: #15803d !important;
    color: #ffffff !important;
  }

  body.legacy-mobile-app table.mobile-card-table td:last-child button[class*="bg-red-"],
  body.legacy-mobile-app table.mobile-card-table td:last-child a[class*="bg-red-"],
  body.legacy-mobile-app table.mobile-card-table td:last-child .btn[class*="bg-red-"] {
    background: #dc2626 !important;
    border-color: #b91c1c !important;
    color: #ffffff !important;
  }

  body.legacy-mobile-app table.mobile-card-table td:last-child button[class*="bg-gray-"],
  body.legacy-mobile-app table.mobile-card-table td:last-child a[class*="bg-gray-"],
  body.legacy-mobile-app table.mobile-card-table td:last-child .btn[class*="bg-gray-"] {
    background: #e5e7eb !important;
    border-color: #d1d5db !important;
    color: #374151 !important;
  }

  @media (max-width: 380px) {
    body.legacy-mobile-app table.mobile-card-table td:not(:last-child) {
      grid-template-columns: 1fr;
      gap: 0.2rem;
    }

    body.legacy-mobile-app table.mobile-card-table td::before {
      font-size: 0.72rem;
    }

    body.legacy-mobile-app table.mobile-card-table td:last-child {
      justify-content: stretch;
    }

    body.legacy-mobile-app table.mobile-card-table td:last-child button,
    body.legacy-mobile-app table.mobile-card-table td:last-child a,
    body.legacy-mobile-app table.mobile-card-table td:last-child .btn {
      width: 100%;
    }
  }

  body.legacy-mobile-app .tabulator {
    border-radius: 1rem;
    overflow: hidden;
  }

  body.legacy-mobile-app .tabulator .tabulator-tableholder {
    overflow-x: auto;
  }

  body.legacy-mobile-app .fixed.top-1\/2.left-1\/2,
  body.legacy-mobile-app [id$="-modal"].fixed.top-1\/2,
  body.legacy-mobile-app .modal.show .modal-dialog {
    inset: auto 0 0 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    max-height: calc(100dvh - max(1rem, env(safe-area-inset-top, 0px))) !important;
    border-radius: 1.5rem 1.5rem 0 0 !important;
  }

  body.legacy-mobile-app .fixed.inset-0 > .bg-white,
  body.legacy-mobile-app [id$="-modal"].fixed.inset-0 > div,
  body.legacy-mobile-app [id="modal"] > div {
    max-height: calc(100dvh - 1rem) !important;
    border-radius: 1.5rem 1.5rem 0 0 !important;
  }

  body.legacy-mobile-app [id$="-modal"] form,
  body.legacy-mobile-app [id$="-modal"] .modal-body,
  body.legacy-mobile-app [id$="-modal"] .p-6,
  body.legacy-mobile-app [id$="-modal"] .card-body {
    max-height: calc(100dvh - 10rem);
    overflow-y: auto;
  }

  body.legacy-mobile-app .modal-footer,
  body.legacy-mobile-app [id$="-modal"] form > div:last-child,
  body.legacy-mobile-app [id$="-modal"] .border-t:last-child {
    padding-bottom: calc(1rem + var(--mobile-app-safe-bottom)) !important;
  }

  body.legacy-mobile-app .bottom-nav,
  body.legacy-mobile-app nav.bottom-nav {
    padding-bottom: calc(0.45rem + var(--mobile-app-safe-bottom)) !important;
    border-radius: 1.25rem 1.25rem 0 0;
  }

  body.legacy-mobile-app .mobile-app-bottom-nav,
  body.legacy-mobile-app nav.mobile-app-bottom-nav {
    border-radius: 1.25rem 1.25rem 0 0;
  }

  body.legacy-page-index .container-fluid {
    margin-top: 0 !important;
  }

  body.legacy-page-index .d-grid,
  body.legacy-page-index .d-md-flex {
    display: grid !important;
    grid-template-columns: 1fr;
  }

  body.legacy-page-index #data-table {
    min-height: 60vh;
  }

  body.legacy-page-dev-management #dashboard-section {
    height: auto !important;
    min-height: 100vh;
    flex-direction: column !important;
    overflow: visible !important;
  }

  body.legacy-page-dev-management aside {
    width: 100% !important;
    max-height: 45vh;
  }

  body.legacy-page-dev-management aside nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }

  body.legacy-page-dev-management aside nav > div,
  body.legacy-page-dev-management aside nav > button {
    margin: 0 !important;
  }

  body.legacy-page-dev-management main {
    min-height: auto;
  }

  body.legacy-page-dev-management #filter-bar,
  body.legacy-page-dev-management main > header {
    flex-wrap: wrap;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  body.legacy-page-dev-management .jsoneditor {
    height: 65vh;
  }

  body.legacy-page-404 #message {
    margin: 1rem auto !important;
    border-radius: 1.25rem !important;
    box-shadow: var(--mobile-app-shadow) !important;
  }
}

@media (min-width: 768px) {
  body.legacy-mobile-app .mobile-card-table {
    min-width: 100%;
  }
}

/* Assets / Parts dashboard — responsive + large system font */
body.legacy-page-assets-dashboard {
  overflow-x: clip;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body.legacy-page-assets-dashboard header h1 {
  font-size: clamp(1.15rem, 4.5vw, 1.85rem) !important;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

body.legacy-page-assets-dashboard #main-content,
body.legacy-page-assets-dashboard .assets-parts-hub,
body.legacy-page-assets-dashboard .assets-scan-modal {
  min-width: 0;
}

body.legacy-page-assets-dashboard .assets-parts-hub input,
body.legacy-page-assets-dashboard .assets-parts-hub select,
body.legacy-page-assets-dashboard .assets-parts-hub button,
body.legacy-page-assets-dashboard #scan-withdraw-panel input,
body.legacy-page-assets-dashboard #scan-withdraw-panel select,
body.legacy-page-assets-dashboard #scan-withdraw-panel button {
  min-height: 2.75rem;
  font-size: max(1rem, 16px);
  line-height: 1.35;
}

body.legacy-page-assets-dashboard .assets-hub-row {
  width: 100%;
}

body.legacy-page-assets-dashboard #view-modal,
body.legacy-page-assets-dashboard #form-modal,
body.legacy-page-assets-dashboard #scan-result-modal {
  max-height: min(92dvh, 92vh);
}

body.legacy-page-assets-dashboard #scan-result-modal .overflow-y-auto,
body.legacy-page-assets-dashboard #view-modal .overflow-auto,
body.legacy-page-assets-dashboard #form-modal .overflow-y-auto {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body.legacy-page-assets-dashboard #table-body td,
body.legacy-page-assets-dashboard #view-table-body td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.legacy-page-assets-dashboard #view-locked-title {
  overflow-wrap: anywhere;
}

@media (max-width: 767px) {
  body.legacy-page-assets-dashboard #pagination-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  body.legacy-page-assets-dashboard #pagination-controls .flex.gap-2 {
    width: 100%;
  }

  body.legacy-page-assets-dashboard #pagination-controls button {
    flex: 1;
    min-height: 2.75rem;
  }
}

