html,
body {
  overflow: hidden;
}
.app-shell {
  overflow: hidden;
}
.base-footer {
  flex: 0 0 auto;
  height: 35px;
}
.base-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.page-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.page-header {
  flex: 0 0 auto;
}
.page-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.frontend-shell {
  padding: 8px 10px 0;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
.frontend-shell-left-right {
  display: flex;
  flex-direction: row;
  height: 100%;
}
.frontend-sidebar {
  width: 240px;
  min-width: 240px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.06);
  margin-right: 10px;
}
.frontend-menu-vertical .nav-link {
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  color: #334155;
}
.frontend-menu-vertical .nav-link.active,
.frontend-menu-vertical .nav-link:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}
.frontend-shell-left-right {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}
.frontend-shell-left-right .page-header {
  width: 240px;
  min-width: 240px;
  height: 100%;
  margin-right: 10px;
  flex: 0 0 240px;
}
.frontend-shell-left-right .frontend-topbar {
  height: 100%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.06);
}
.frontend-shell-left-right .frontend-topbar .container-fluid {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  height: 100%;
  padding: 1.25rem 1rem;
}
.frontend-shell-left-right .frontend-topbar .navbar-brand {
  margin-right: 0;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
}
.frontend-shell-left-right .frontend-topbar .navbar-toggler {
  display: none !important;
}
.frontend-shell-left-right .frontend-topbar .navbar-collapse {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto;
  align-items: stretch !important;
  justify-content: space-between !important;
}
.frontend-shell-left-right .frontend-menu-list {
  display: flex !important;
  flex-direction: column !important;
  margin-left: 0 !important;
  margin-bottom: auto !important;
  width: 100% !important;
}
.frontend-shell-left-right .frontend-menu-list .nav-item {
  width: 100%;
}
.frontend-shell-left-right .frontend-menu-list .nav-link {
  width: 100%;
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  color: #334155;
}
.frontend-shell-left-right .frontend-menu-list .nav-link.active,
.frontend-shell-left-right .frontend-menu-list .nav-link:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}
.frontend-shell-left-right .frontend-topbar .ms-auto {
  margin-left: 0 !important;
  margin-top: auto !important;
  width: 100% !important;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}
.frontend-shell-left-right .frontend-topbar .user-menu {
  width: 100%;
  position: relative;
}
.frontend-shell-left-right .frontend-topbar .user-menu__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.frontend-shell-left-right .frontend-topbar .user-menu .dropdown-menu {
  top: auto !important;
  bottom: 100% !important;
  margin-top: 0 !important;
  margin-bottom: 0.5rem !important;
  left: 0 !important;
  right: 0 !important;
  transform: none !important;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12) !important;
}
.frontend-shell-left-right .frontend-main {
  flex: 1 1 auto;
  overflow-y: auto;
}
.frontend-topbar {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: radial-gradient(circle at top right, rgba(96, 165, 250, 0.16), transparent 28%), linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}
.frontend-topbar .container-fluid {
  padding: 0.25rem 0.5rem;
}
.frontend-main {
  padding-top: 8px;
}
.frontend-menu-list {
  margin-left: 1rem;
  gap: 0.25rem;
}
.frontend-menu-list .nav-link {
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  color: #334155;
}
.frontend-menu-list .nav-link.active,
.frontend-menu-list .nav-link:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}
.auth-page-main {
  padding: 1.25rem;
}
.auth-shell {
  background: radial-gradient(circle at top left, rgba(13, 110, 253, 0.12), transparent 28%), radial-gradient(circle at bottom right, rgba(249, 115, 22, 0.14), transparent 24%), linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
.auth-shell-login {
  background: radial-gradient(circle at top left, rgba(13, 110, 253, 0.16), transparent 28%), radial-gradient(circle at bottom right, rgba(2, 132, 199, 0.12), transparent 22%), linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%);
}
.auth-shell-register {
  background: radial-gradient(circle at top left, rgba(22, 163, 74, 0.14), transparent 28%), radial-gradient(circle at bottom right, rgba(249, 115, 22, 0.16), transparent 24%), linear-gradient(180deg, #f8faf5 0%, #f7efe7 100%);
}
.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  height: 100%;
  max-width: 100%;
  padding: 32px 16px;
  margin: 0 auto;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
}
.auth-shell-login .auth-card {
  box-shadow: 0 20px 48px rgba(37, 99, 235, 0.09);
}
.auth-shell-register .auth-card {
  box-shadow: 0 20px 48px rgba(249, 115, 22, 0.09);
}
.auth-card-body {
  padding: 36px 32px;
}
.auth-header-wrap {
  text-align: center;
}
.auth-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, #f1f5f9 0%, #ffffff 100%);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.auth-title {
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 1.55rem;
  font-weight: 700;
  text-align: center;
}
.auth-subtitle {
  margin-bottom: 0;
  color: #64748b;
  font-size: 0.92rem;
  text-align: center;
}
.auth-inline-row {
  color: #475569;
}
.auth-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.auth-submit-btn {
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.25rem;
  transition: all 0.2s ease;
}
.auth-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(13, 110, 253, 0.25);
}
.auth-submit-btn:active {
  transform: translateY(0);
}
.auth-shell-login .auth-submit-btn {
  background: linear-gradient(135deg, #0d6efd 0%, #2563eb 100%);
}
.auth-shell-register .auth-submit-btn {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}
.auth-shell-register .auth-submit-btn:hover {
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.25);
}
.auth-card .form-floating > label {
  color: #64748b;
}
.auth-card .form-control {
  border-radius: 14px;
}
.password-input {
  position: relative;
}
.password-input > .form-control,
.password-input.form-floating > .form-control {
  padding-right: 2.75rem;
}
.password-input > .form-control.is-invalid,
.password-input.form-floating > .form-control.is-invalid {
  padding-right: calc(2.75rem + 1.5em + 0.75rem);
  background-position: right 2.75rem center;
}
.password-input .password-input__toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2));
  width: 2.75rem;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  text-decoration: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  z-index: 5;
  cursor: pointer;
}
.password-input .password-input__toggle:hover,
.password-input .password-input__toggle:focus {
  color: #0f172a;
  text-decoration: none;
  outline: none;
  box-shadow: none;
}
.password-input .password-input__toggle i {
  font-size: 1.15rem;
  line-height: 1;
}
.password-input.form-floating .password-input__toggle {
  height: calc(3.5rem + calc(var(--bs-border-width) * 2));
}
@media (max-width: 860px) {
  .frontend-shell {
    padding: 6px 6px 0;
  }
  .frontend-main {
    padding-top: 6px;
  }
  .frontend-menu-list {
    margin-left: 0;
    gap: 0;
  }
  .auth-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .auth-panel-brand {
    padding: 8px 8px 0;
  }
  .auth-brand-copy p {
    max-width: none;
  }
  .auth-card-body {
    padding: 24px;
  }
  .auth-panel-form {
    justify-content: center;
  }
}
.app-toast-container {
  --app-toast-success: #1f9d55;
  --app-toast-info: #1d6fdc;
  --app-toast-warning: #d38b11;
  --app-toast-error: #cf3f4f;
  padding: 16px;
  z-index: 1090;
}
.app-toast {
  overflow: hidden;
  min-width: 340px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.16);
  backdrop-filter: blur(12px);
}
.app-toast + .app-toast {
  margin-top: 12px;
}
.app-toast::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--app-toast-info);
}
.app-toast-success::before {
  background: var(--app-toast-success);
}
.app-toast-warning::before {
  background: var(--app-toast-warning);
}
.app-toast-error::before {
  background: var(--app-toast-error);
}
.app-toast-header {
  padding: 14px 16px 10px;
  border-bottom: 0;
  background: transparent;
}
.app-toast-title {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.app-toast-app {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
}
.app-toast-body {
  padding: 0 16px 16px;
  color: #1f2937;
  font-size: 0.95rem;
  line-height: 1.5;
}
.markdown-body {
  max-width: none;
  padding: 0;
  background: transparent;
  color: #1f2937;
  line-height: 1.7;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}
.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre {
  margin-bottom: 1rem;
}
.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5rem;
}
.markdown-body code {
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: #f3f4f6;
  font-size: 0.9em;
}
.markdown-body pre {
  padding: 1rem;
  overflow-x: auto;
  border-radius: 12px;
  background: #111827;
  color: #f9fafb;
}
.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

/* PWA Offline Warning Banner */
.pwa-offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.pwa-offline-banner[hidden] {
  display: none !important;
}
.pwa-offline-banner.is-offline {
  background-color: #fffbeb;
  color: #92400e;
  border-bottom: 1px solid #fcd34d;
}
.pwa-offline-banner.is-online {
  background-color: #f0fdf4;
  color: #166534;
  border-bottom: 1px solid #86efac;
}
.pwa-offline-content {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pwa-offline-icon {
  font-size: 16px;
}
.pwa-offline-retry-btn {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}
.pwa-offline-retry-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
@keyframes pulseWarn {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
.pwa-offline-banner.pulse-warn {
  animation: pulseWarn 0.3s ease;
}

/* PWA Install Banner */
.pwa-install-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 9990;
  width: calc(100% - 32px);
  max-width: 480px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
}
.pwa-install-banner.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.pwa-install-banner[hidden] {
  display: none !important;
}
.pwa-install-banner-body {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.pwa-install-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
.pwa-install-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pwa-install-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pwa-install-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pwa-install-btn-dismiss {
  border: none;
  background: transparent;
  color: #64748b;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.pwa-install-btn-dismiss:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.pwa-install-btn-confirm {
  border: none;
  background: #0284c7;
  color: #ffffff;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.pwa-install-btn-confirm:hover {
  background: #0369a1;
}

@media (max-width: 768px) {
  .pwa-install-banner {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .pwa-install-actions {
    justify-content: flex-end;
  }
  .pwa-install-btn-dismiss,
  .pwa-install-btn-confirm {
    min-height: 32px;
  }
}
