/* SRY App Management — clean management-system design */
:root {
  --navy: #214f78;
  --navy-dark: #183d5e;
  --navy-soft: #edf3f8;
  --green: #33835d;
  --green-dark: #276a4a;
  --green-soft: #edf7f1;
  --red: #a84f4f;
  --amber: #9a6a27;
  --canvas: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --border: #e1e6ea;
  --border-strong: #cbd4dc;
  --text: #293642;
  --muted: #6d7985;
  --muted-light: #96a0aa;
  --shadow: 0 3px 12px rgba(32, 52, 70, 0.055);
  --bs-primary: #214f78;
  --bs-primary-rgb: 33, 79, 120;
  --bs-success: #33835d;
  --bs-success-rgb: 51, 131, 93;
  --bs-link-color: #214f78;
  --bs-link-hover-color: #183d5e;
}

html {
  font-size: 16px;
}

body,
button,
input,
select,
textarea {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

body {
  color: var(--text);
  background: var(--canvas);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--navy);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text);
  font-weight: 600;
}

/* Sidebar */
.app-navbar {
  background: var(--surface);
}

.app-brand-icon {
  object-fit: contain;
}

.app-user-dropdown {
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(32, 52, 70, 0.12);
}

.app-user-dropdown .dropdown-item {
  min-height: 34px;
  border-radius: 7px;
  font-size: 0.84rem;
}

@media (min-width: 992px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    display: block !important;
  }

  .app-navbar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: 224px;
    min-height: 100vh;
    padding: 0;
    border-right: 1px solid var(--border);
    box-shadow: 3px 0 16px rgba(32, 52, 70, 0.035);
  }

  .app-navbar .container-fluid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 100vh;
    padding: 0 11px !important;
  }

  .app-navbar .navbar-brand {
    flex: 0 0 auto;
    min-height: 68px;
    margin: 0;
    padding: 0 5px;
    border-bottom: 1px solid #edf0f3;
    color: #253746;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
  }

  .app-navbar .navbar-brand span {
    display: block;
    overflow: visible;
    max-width: none;
    white-space: normal;
  }

  .app-navbar .app-brand-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .app-navbar .navbar-collapse {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    padding: 0.85rem 0 0.8rem;
  }

  .app-navbar .navbar-nav {
    display: grid;
    gap: 0.25rem;
    width: 100%;
    margin: 0 !important;
  }

  .app-navbar .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 40px;
    padding: 0.5rem 0.72rem;
    border-radius: 8px;
    color: #627180;
    font-size: 0.84rem;
    font-weight: 500;
  }

  .app-navbar .nav-link i {
    width: 18px;
    color: var(--navy);
    text-align: center;
  }

  .app-navbar .nav-link:hover,
  .app-navbar .nav-link:focus {
    color: var(--navy);
    background: #f2f6f9;
  }

  .app-navbar .nav-link.active {
    color: var(--navy);
    background: #e8f0f6;
  }

  .app-navbar .nav-link.active::before {
    content: "";
    position: absolute;
    left: -11px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--navy);
  }

  .app-navbar .navbar-collapse > .d-flex {
    display: block !important;
    width: 100%;
    margin: auto 0 0 !important;
    padding-top: 0.8rem;
    border-top: 1px solid #edf0f3;
  }

  .app-navbar .navbar-collapse > .d-flex > .d-flex {
    display: grid !important;
    gap: 0.45rem !important;
    width: 100%;
  }

  .app-navbar .navbar-collapse > .d-flex .btn,
  .app-navbar .publish-app-btn,
  .app-navbar .dropdown,
  .app-navbar .dropdown > .btn {
    width: 100%;
  }

  .app-navbar .dropdown > .btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main.container-fluid {
    width: calc(100% - 224px);
    height: 100vh;
    min-height: 0;
    margin: 0 0 0 224px !important;
    padding: 1rem 1.35rem 1.5rem !important;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
  }

}

.app-footer {
  min-height: 36px;
  padding-top: 0.6rem;
  font-size: 12px;
}

/* Shared title bar for every content page. */
.page-titlebar,
.index-page-header.page-titlebar {
  width: 100%;
  min-height: 66px;
  margin-bottom: 0.85rem !important;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.page-titlebar .page-heading {
  margin-top: 0;
  margin-bottom: 0;
  color: var(--text);
}

.page-titlebar .page-heading > i {
  width: 32px;
  height: 32px;
  margin-right: 0.4rem;
  border: 1px solid #d7e2eb;
  border-radius: 8px;
  color: var(--navy);
  background: var(--navy-soft);
}

.page-titlebar .text-muted,
.page-titlebar p {
  color: var(--muted) !important;
}

.index-page-header.page-titlebar p {
  margin: 0.25rem 0 0 2.65rem;
}

.page-titlebar > .d-flex:last-child {
  align-items: center;
}

.page-titlebar .btn {
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .page-titlebar,
  .index-page-header.page-titlebar {
    min-height: 58px;
    padding: 0.65rem 0.75rem;
  }

  .page-titlebar .page-heading > i {
    width: 30px;
    height: 30px;
  }
}

/* Page headers and surfaces */
.page-heading {
  margin: 0;
  color: var(--text);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.35;
}

.page-heading > i {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 0.35rem;
  border-radius: 8px;
  color: var(--navy);
  background: var(--navy-soft);
  vertical-align: -0.18em;
}

.index-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  margin-bottom: 0.75rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.index-page-header h3 {
  margin: 0;
}

.index-page-header p {
  margin: 0.3rem 0 0 2.55rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.index-app-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid #d5e8dd;
  border-radius: 8px;
  color: var(--muted);
  background: var(--green-soft);
  font-size: 0.78rem;
}

.index-app-count strong {
  color: var(--green);
  font-size: 1.08rem;
}

.card,
.muted-box,
.empty-state {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-body {
  padding: 1rem;
}

.muted-box {
  padding: 1rem;
}

/* Controls */
.btn {
  min-height: 36px;
  border-radius: 8px;
  font-weight: 500;
}

.btn-sm {
  min-height: 32px;
  padding: 0.3rem 0.66rem;
  font-size: 0.8rem;
}

.btn-primary,
.publish-app-btn {
  --bs-btn-bg: var(--navy);
  --bs-btn-border-color: var(--navy);
  --bs-btn-hover-bg: var(--navy-dark);
  --bs-btn-hover-border-color: var(--navy-dark);
  box-shadow: none;
}

.btn-success {
  --bs-btn-bg: var(--green);
  --bs-btn-border-color: var(--green);
  --bs-btn-hover-bg: var(--green-dark);
  --bs-btn-hover-border-color: var(--green-dark);
}

.btn-outline-primary,
.btn-outline-secondary {
  --bs-btn-color: var(--navy);
  --bs-btn-border-color: #9fb2c3;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: var(--navy);
  --bs-btn-hover-border-color: var(--navy);
}

.app-navbar .btn-outline-light {
  color: var(--navy);
  border-color: #b7c5d0;
  background: #ffffff;
}

.app-navbar .btn-outline-light:hover {
  color: #ffffff;
  border-color: var(--navy);
  background: var(--navy);
}

.btn-danger-action,
.btn-warning-action,
.btn-success-action {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 8px;
}

.btn-danger-action {
  color: var(--red);
  border: 1px solid #dbb8b8;
  background: #fffafa;
}

.btn-warning-action {
  color: var(--amber);
  border: 1px solid #ddcba9;
  background: #fffcf7;
}

.btn-success-action {
  color: var(--green);
  border: 1px solid #acd1bd;
  background: var(--green-soft);
}

.form-label {
  margin-bottom: 0.38rem;
  color: #465562;
  font-size: 0.84rem;
  font-weight: 500;
}

.form-control,
.form-select {
  min-height: 38px;
  border-color: var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.86rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #7998b2;
  box-shadow: 0 0 0 2px rgba(33, 79, 120, 0.11);
}

.form-control::placeholder {
  color: #a0aab3;
}

.form-text {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Toolbars and pickers */
.table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 36px;
  padding: 0 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
}

.search-wrap:focus-within {
  border-color: #7998b2;
  box-shadow: 0 0 0 2px rgba(33, 79, 120, 0.11);
}

.search-wrap i {
  color: var(--navy);
}

.search-wrap .form-control {
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.index-filter-row {
  flex-wrap: nowrap;
  margin-bottom: 0.8rem !important;
}

.index-filter-row .search-wrap {
  width: 220px;
  flex: 0 0 220px;
}

.name-picker {
  position: relative;
  width: 200px;
  flex: 0 0 200px;
}

.name-picker .search-wrap {
  width: 100%;
}

.name-picker-toggle {
  width: 18px;
  color: var(--muted) !important;
}

.name-picker-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  z-index: 50;
  overflow-y: auto;
  max-height: 260px;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(32, 52, 70, 0.11);
}

.name-picker-option {
  width: 100%;
  min-height: 32px;
  padding: 0.35rem 0.55rem;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.name-picker-option:hover {
  background: var(--navy-soft);
}

.toolbar-select {
  width: 135px;
  flex: 0 0 135px;
}

.compact-filter-row .search-wrap {
  min-width: 220px;
  flex: 1 1 260px;
}

/* Application cards */
.app-card-grid {
  --bs-gutter-x: 0.85rem;
}

.app-card-item {
  display: flex;
  margin-bottom: 0.85rem !important;
}

.app-card {
  width: 100%;
  overflow: hidden;
  border-color: var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.app-card:hover {
  border-color: #cbd6de;
  box-shadow: 0 6px 16px rgba(32, 52, 70, 0.08);
}

.app-card .card-body {
  display: flex;
  flex-direction: column;
  padding: 0.9rem;
}

.app-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.6rem;
}

.app-card-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.app-card-icon {
  width: 42px;
  height: 42px;
  padding: 7px;
  border: 1px solid #d6e2eb;
  border-radius: 10px;
  object-fit: contain;
  background: var(--navy-soft);
}

.app-card-identity,
.app-card-title {
  min-width: 0;
}

.app-card-title > a {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-card-publisher {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.73rem;
  white-space: nowrap;
}

.app-card-publisher i {
  color: var(--navy);
}

.app-badge {
  max-width: 7rem;
  overflow: hidden;
  padding: 0.28rem 0.52rem;
  border: 1px solid #cfdae3;
  border-radius: 999px;
  color: var(--navy);
  background: var(--navy-soft);
  font-size: 0.69rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-card-desc {
  display: -webkit-box;
  overflow: hidden;
  min-height: 2.85em;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app-card-desc-empty {
  color: var(--muted-light);
  font-style: italic;
}

.app-card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.65rem;
}

.app-card-actions .btn {
  min-height: 31px;
}

/* Tables, empty states and pagination */
.table-responsive {
  border: 1px solid var(--border);
  border-radius: 9px;
}

.table {
  margin-bottom: 0;
  --bs-table-border-color: #e7ebee;
  --bs-table-hover-bg: #f7f9fb;
}

.table > :not(caption) > * > * {
  padding: 0.68rem 0.72rem;
}

.table thead th {
  color: #586775;
  background: #f7f9fb;
  font-size: 0.77rem;
  font-weight: 600;
  white-space: nowrap;
}

.table tbody td {
  color: #42505c;
  font-size: 0.82rem;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 auto 0.55rem;
  border-radius: 50%;
  color: var(--navy);
  background: var(--navy-soft);
  font-size: 1.1rem;
}

.empty-title {
  color: var(--text);
  font-weight: 600;
}

.empty-desc {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.pager-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.pager-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.pagination {
  gap: 0.2rem;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0.3rem 0.52rem;
  border-color: var(--border);
  border-radius: 7px !important;
  color: var(--navy);
}

.page-item.active .page-link {
  border-color: var(--navy);
  background: var(--navy);
}

.pager-row form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Misc components */
.app-detail-meta-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.app-shelf-badge,
.badge {
  border-radius: 999px;
}

.preformatted-user-text {
  white-space: pre-wrap;
}

.app-toast-container {
  z-index: 1080;
  pointer-events: none;
}

.app-toast {
  min-width: 270px;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(32, 52, 70, 0.16);
  pointer-events: auto;
}

#globalConfirmModal .modal-content {
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Login modal */
.app-login-modal .modal-dialog {
  max-width: 740px;
}

.app-login-modal .modal-content {
  position: relative;
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  overflow: hidden;
  min-height: 440px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 22px 52px rgba(32, 52, 70, 0.14);
}

.app-login-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
}

.app-login-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.25rem 2rem 1.9rem;
  border-right: 1px solid var(--border);
  background: #f1f5f8;
}

.app-login-modal-icon {
  width: 54px;
  height: 54px;
  padding: 8px;
  border: 1px solid #d8e2e9;
  border-radius: 13px;
  object-fit: contain;
  background: #ffffff;
}

.app-login-modal-kicker {
  color: #758695;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.app-login-intro-title {
  margin: 0 0 0.7rem;
  font-size: 1.42rem;
}

.app-login-intro-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.75;
}

.app-login-intro-features {
  display: grid;
  gap: 0.7rem;
  margin: 1.7rem 0 0;
  padding: 0;
  list-style: none;
}

.app-login-intro-features li {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.app-login-intro-features i {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--navy);
  background: #ffffff;
}

.app-login-intro-features li:nth-child(n + 2) i {
  color: var(--green);
}

.app-login-intro-features strong {
  display: block;
  color: #41505c;
  font-size: 0.78rem;
}

.app-login-form-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.2rem 2.1rem 1.8rem;
}

.app-login-form-heading {
  margin-bottom: 1.3rem;
}

.app-login-form-heading .modal-title {
  margin: 0 0 0.3rem;
  font-size: 1.32rem;
}

.app-login-form-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.app-login-modal .form-control {
  min-height: 40px;
}

.app-login-modal-footer {
  display: grid;
  gap: 0.3rem;
  padding-top: 1rem;
}

.app-login-submit-btn {
  width: 100%;
  min-height: 40px;
}

.app-login-later-btn {
  min-height: 30px;
  color: #566878;
  font-size: 0.75rem;
  text-decoration: none;
}

.app-login-later-btn:hover,
.app-login-later-btn:focus {
  color: var(--navy-dark);
  background: var(--navy-soft);
}

/* Standalone login fallback */
.login-page {
  min-height: 100vh;
  color: var(--text);
  background: var(--canvas);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
  gap: 3rem;
  width: min(1100px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 2rem;
}

.login-brand-panel,
.login-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand-content {
  max-width: 500px;
}

.login-brand-topline {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.login-brand-mark {
  width: 40px;
  height: 40px;
}

.login-brand-kicker,
.login-form-kicker {
  margin: 0;
  color: var(--navy);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.login-brand-title {
  display: grid;
  gap: 0.2rem;
  margin: 0;
}

.login-brand-name {
  font-size: 2.2rem;
  font-weight: 600;
}

.login-brand-product {
  color: var(--navy);
  font-size: 1.35rem;
  font-weight: 600;
}

.login-brand-tagline,
.login-brand-lead,
.login-feature-list span,
.login-brand-footer {
  color: var(--muted);
}

.login-feature-list {
  display: grid;
  gap: 0.7rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.login-feature-list li {
  padding-left: 0.8rem;
  border-left: 3px solid var(--green);
}

.login-feature-list strong,
.login-feature-list span {
  display: block;
}

.login-brand-footer {
  margin-top: 2rem;
  font-size: 0.75rem;
}

.login-card {
  padding: 1.8rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(32, 52, 70, 0.1);
}

.login-form-title {
  margin: 0.25rem 0;
  font-size: 1.3rem;
}

.login-form-subtitle,
.login-card-footer {
  color: var(--muted);
  font-size: 0.78rem;
}

.login-field {
  margin-bottom: 0.85rem;
}

.login-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.login-input {
  min-height: 40px;
}

.login-submit-btn {
  width: 100%;
  color: #ffffff;
  background: var(--navy);
}

/* Responsive */
@media (min-width: 1400px) {
  .app-card-item {
    width: 25%;
  }
}

@media (max-width: 991.98px) {
  .app-navbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    min-height: 60px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(32, 52, 70, 0.06);
  }

  .app-navbar .navbar-brand {
    color: var(--text);
  }

  .app-navbar .navbar-toggler {
    border-color: var(--border-strong);
    filter: grayscale(1) brightness(0.55);
  }

  .app-navbar .navbar-collapse {
    margin-top: 0.5rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--border);
  }

  .app-navbar .nav-link {
    color: var(--muted);
  }

  .app-navbar .nav-link.active {
    color: var(--navy);
    background: var(--navy-soft);
  }

  .app-navbar .navbar-collapse > .d-flex > .d-flex {
    flex-wrap: wrap;
  }

  .index-filter-row {
    flex-wrap: wrap;
  }

  .index-filter-row .search-wrap,
  .name-picker {
    flex: 1 1 190px;
    width: auto;
  }
}

@media (max-width: 767.98px) {
  .app-login-modal .modal-dialog {
    max-width: 500px;
  }

  .app-login-modal .modal-content {
    display: block;
    min-height: 0;
  }

  .app-login-intro {
    padding: 1.25rem 3rem 1.1rem 1.25rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .app-login-intro .app-login-modal-icon,
  .app-login-intro-lead,
  .app-login-intro-features {
    display: none;
  }

  .app-login-intro-title {
    margin: 0;
    font-size: 1.1rem;
  }

  .app-login-form-side {
    padding: 1.5rem 1.25rem 1.2rem;
  }

  .login-shell {
    display: block;
    padding: 1.25rem;
  }

  .login-brand-panel {
    display: none;
  }

  .login-form-panel {
    min-height: calc(100vh - 2.5rem);
  }
}

@media (max-width: 575.98px) {
  main.container-fluid {
    margin-top: 0.65rem !important;
  }

  .index-page-header {
    min-height: 74px;
    padding: 0.8rem;
  }

  .index-page-header p {
    display: none;
  }

  .index-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .index-filter-row .search-wrap,
  .index-filter-row .name-picker {
    width: 100%;
    grid-column: 1 / -1;
  }

  .index-filter-row .toolbar-select {
    width: 100%;
  }

  .index-filter-row > .btn {
    grid-column: 1 / -1;
  }
}

/* Unified typography scale */
:root {
  --font-page-title: 1.25rem;   /* 20px */
  --font-section-title: 1rem;   /* 16px */
  --font-body: 0.9375rem;       /* 15px */
  --font-control: 0.875rem;     /* 14px */
  --font-meta: 0.8125rem;       /* 13px */
  --font-caption: 0.75rem;      /* 12px */
}

body {
  font-size: var(--font-body);
  line-height: 1.6;
}

/* Page-level titles are identical on every route. */
.page-heading,
h3.page-heading,
h4.page-heading {
  font-size: var(--font-page-title);
  font-weight: 600;
  line-height: 1.4;
}

/* Section headings inside cards and functional blocks. */
.muted-box > .fw-semibold,
.card-body > .fw-semibold,
.app-login-form-heading .modal-title,
.login-form-title {
  font-size: var(--font-section-title);
  font-weight: 600;
  line-height: 1.45;
}

/* Normal content. */
p,
.card-body,
.muted-box,
.modal-body {
  font-size: var(--font-body);
}

/* Forms and buttons share one control size. */
.form-label,
.form-control,
.form-select,
.btn,
.dropdown-item,
.name-picker-option,
.page-link {
  font-size: var(--font-control);
  line-height: 1.5;
}

.btn-sm,
.form-control-sm,
.form-select-sm {
  font-size: var(--font-control);
}

/* Tables use the same scale throughout admin and detail pages. */
.table thead th,
.table tbody td,
.table td,
.table th {
  font-size: var(--font-control);
  line-height: 1.5;
}

.table thead th {
  font-weight: 600;
}

/* Application card hierarchy. */
.app-card-title > a {
  font-size: var(--font-body);
  line-height: 1.4;
}

.app-card-desc {
  font-size: var(--font-control);
  line-height: 1.55;
}

.app-card-publisher,
.index-page-header p,
.index-app-count,
.empty-desc,
.form-text,
.text-muted.small,
.small,
small {
  font-size: var(--font-meta) !important;
  line-height: 1.55;
}

.app-badge,
.badge,
.app-login-modal-kicker,
.login-brand-kicker,
.login-form-kicker {
  font-size: var(--font-caption);
  line-height: 1.4;
}

/* Navigation and footer. */
.app-navbar .navbar-brand {
  font-size: var(--font-control);
}

.app-navbar .nav-link,
.app-navbar .navbar-collapse .btn {
  font-size: var(--font-control);
}

.app-footer {
  font-size: var(--font-caption) !important;
}

/* Login typography follows the same scale. */
.app-login-intro-title {
  font-size: 1.375rem;
  line-height: 1.4;
}

.app-login-intro-lead,
.app-login-form-heading p,
.login-form-subtitle,
.login-card-footer {
  font-size: var(--font-meta);
  line-height: 1.6;
}

.app-login-intro-features strong,
.app-login-intro-features li,
.login-label,
.login-input,
.app-login-later-btn {
  font-size: var(--font-control);
}

/* Application card metadata: publisher, likes and downloads on one row. */
.app-card-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: var(--font-meta);
  line-height: 1.4;
}

.app-card-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  white-space: nowrap;
}

.app-card-meta .app-card-publisher {
  overflow: hidden;
  margin: 0;
  font-size: inherit;
}

.app-card-meta .app-card-publisher > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-card-meta > span:nth-child(1) i,
.app-card-meta > span:nth-child(2) i {
  color: var(--navy);
}

.app-card-meta > span:nth-child(3) i {
  color: var(--green);
}

.app-card-meta strong {
  color: #45525e;
  font-weight: 600;
}

.app-card-actions .btn:disabled .bi-eye-slash {
  color: inherit;
}

@media (max-width: 575.98px) {
  .app-card-meta {
    gap: 0.45rem;
  }
}

/* Sidebar user menu must open upward and remain above the workspace. */
.app-user-menu {
  position: relative;
  z-index: 1060;
}

@media (min-width: 992px) {
  .app-user-menu .app-user-dropdown {
    top: auto !important;
    right: auto !important;
    bottom: calc(100% + 0.45rem) !important;
    left: 0 !important;
    width: 100%;
    min-width: 100%;
    margin: 0 !important;
    transform: none !important;
    z-index: 1070;
  }

  .app-navbar,
  .app-navbar .container-fluid,
  .app-navbar .navbar-collapse,
  .app-navbar .navbar-collapse > .d-flex {
    overflow: visible;
  }
}
