:root {
  --bg: #F2E9D0;
  --bg-soft: #fff8f2;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --line: rgba(17, 17, 17, 0.1);
  --text: #111111;
  --muted: #636363;
  --maroon: #b51f3b;
  --maroon-dark: #8d1730;
  --gold: #d8a63b;
  --gold-soft: rgba(216, 166, 59, 0.14);
  --black: #111111;
  --good: #1f7a4d;
  --late: #b32323;
  --shadow: 0 22px 55px rgba(17, 17, 17, 0.12);
}

@media (max-width: 768px) {
  body[data-page="portal"]:not(.portal-logged-in) .gate-layout {
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
    min-height: auto !important;
    height: auto !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-panel {
    position: relative !important;
    inset: auto !important;
    display: none !important;
    min-height: 0 !important;
    height: auto !important;
    flex: 0 0 auto !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    transition: none !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-panel:not(.hidden) {
    display: flex !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-tabs {
    margin-bottom: 10px !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin,
  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-about {
    flex: 0 0 auto !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin .gate-form {
    margin-bottom: 0 !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin .helper-text {
    margin-bottom: 0 !important;
  }
}

@media (max-width: 768px) {
  body[data-page="portal"].portal-logged-in {
    overflow-x: hidden;
    background: #f2f1ed;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  body.theme-dark[data-page="portal"].portal-logged-in {
    background: #121212;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar {
    background: #c0002a;
    border: 0;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
    padding: 10px 12px;
    min-height: 66px;
    align-items: flex-start;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-ghost .ghost-primary {
    color: rgba(255, 255, 255, 0.42);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-ghost .ghost-secondary {
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    line-height: 1.05;
  }

  body[data-page="portal"].portal-logged-in .portal-notification-toggle {
    color: #ffffff;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-row {
    display: block !important;
    padding: 10px 12px 8px;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-pill {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    color: #ffffff;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-copy strong {
    font-size: 0.86rem;
    line-height: 1;
    letter-spacing: 0.02em;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-copy span {
    font-size: 0.62rem;
    line-height: 1;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.68);
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-badge {
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.62rem;
    white-space: nowrap;
  }

  body[data-page="portal"].portal-logged-in .mobile-pagebar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin: 0;
    background: #ffffff;
    border-top: 1px solid #ece7e1;
    border-bottom: 1px solid #e3ddd7;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 22;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .mobile-pagebar {
    background: #1e1e1e;
    border-top-color: #2a2a2a;
    border-bottom-color: #2a2a2a;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  }

  body[data-page="portal"].portal-logged-in .mobile-page-name {
    font-size: 0.98rem;
    font-weight: 700;
    color: #1a1a1a;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .mobile-page-name {
    color: #f0f0f0;
  }

  body[data-page="portal"].portal-logged-in .mobile-menu-toggle {
    display: grid !important;
    width: 38px;
    height: 38px;
    border: 0;
    padding: 0;
    border-radius: 10px;
    background: transparent;
    place-items: center;
    gap: 3px;
  }

  body[data-page="portal"].portal-logged-in .mobile-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #cbbca6;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .mobile-menu-toggle span {
    background: #f0f0f0;
  }

  body[data-page="portal"].portal-logged-in .portal-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  body[data-page="portal"].portal-logged-in .portal-layout > .content-stack {
    width: 100%;
    padding: 0;
  }

  body[data-page="portal"].portal-logged-in .portal-layout > .content-stack > .panel {
    margin: 0 0 12px;
    border-radius: 16px;
  }

  body[data-page="portal"].portal-logged-in .portal-layout > .sidebar,
  body[data-page="portal"].portal-logged-in .portal-layout > .sidebar.panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 25vw;
    min-width: 25vw;
    max-width: 25vw;
    height: 100dvh;
    margin: 0;
    padding: 42px 6px 12px;
    transform: translateX(100%);
    transition: transform 240ms ease;
    overflow-y: auto;
    overflow-x: hidden;
    background: #1c1c1e !important;
    color: rgba(255, 255, 255, 0.92);
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0;
    z-index: 60;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.38);
  }

  body.mobile-drawer-open .portal-layout > .sidebar,
  body.mobile-drawer-open .portal-layout > .sidebar.panel {
    transform: translateX(0) !important;
  }

  .mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 55;
  }

  body.mobile-drawer-open .mobile-drawer-overlay {
    display: block !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-mobile-close {
    display: grid;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.78);
    place-items: center;
  }

  body[data-page="portal"].portal-logged-in .sidebar-logo-block,
  body[data-page="portal"].portal-logged-in .identity-strip {
    display: none !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav {
    display: grid !important;
    width: 100%;
    gap: 6px;
    padding: 0;
    margin-top: 0;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav button {
    width: 100%;
    min-height: 40px;
    padding: 6px 4px;
    border-radius: 12px;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav button span:last-child {
    font-size: 0.56rem;
    line-height: 1.05;
    text-align: center;
  }

  body[data-page="portal"].portal-logged-in .nav-item-icon {
    font-size: 0.82rem;
  }

  body[data-page="portal"].portal-logged-in .sidebar-bottom-actions {
    margin-top: auto;
    width: 100%;
    padding-top: 8px;
    gap: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  body[data-page="portal"].portal-logged-in .theme-switch-wrapper {
    width: 100%;
    display: flex;
    padding: 2px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  body[data-page="portal"].portal-logged-in .theme-switch-btn {
    flex: 1 1 0;
    min-height: 30px;
    font-size: 0.76rem;
    background: transparent !important;
    box-shadow: none !important;
  }

  body[data-page="portal"].portal-logged-in .light-btn.is-active {
    background: #ffffff !important;
    color: #333333 !important;
  }

  body[data-page="portal"].portal-logged-in .dark-btn.is-active {
    background: #c0002a !important;
    color: #ffffff !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-profile-button.sidebar-quick-action {
    grid-template-columns: auto;
    justify-items: center;
  }

  body[data-page="portal"].portal-logged-in .sidebar-profile-copy {
    display: none !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-profile-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
  }

  body[data-page="portal"].portal-logged-in .sidebar-quick-action {
    width: 100%;
    min-height: 42px;
    padding: 8px 8px;
    border-radius: 12px;
  }

  body[data-page="portal"].portal-logged-in #sidebarSignOutButton {
    color: #ff788d;
    border-color: rgba(192, 0, 42, 0.4);
    background: rgba(192, 0, 42, 0.08);
  }
}

@media (max-width: 768px) {
  body[data-page="portal"] {
    overflow-x: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  body[data-page="portal"]:not(.portal-logged-in) {
    height: 100dvh;
    overflow: hidden;
    background: #121212;
  }

  body[data-page="portal"] .shell {
    width: 100%;
    padding: 0;
  }

  body[data-page="portal"] .login-slideshow {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
  }

  body[data-page="portal"].portal-logged-in .login-slideshow {
    display: none;
  }

  body[data-page="portal"]:not(.portal-logged-in) .portal-topbar,
  body[data-page="portal"]:not(.portal-logged-in) .portal-alerts-full {
    display: none !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-shell {
    position: relative;
    z-index: 1;
    min-height: 100dvh;
    padding: 12px 0 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo-wrap {
    display: flex;
    justify-content: center;
    padding: 2px 12px 0;
    position: relative;
    z-index: 2;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo-card {
    display: grid;
    place-items: center;
    padding: 10px 14px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo {
    width: 88px;
    height: auto;
    display: block;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-layout {
    width: min(92vw, 390px);
    margin: 0 auto;
    grid-template-columns: 1fr;
    min-height: calc(100dvh - 136px);
    max-height: calc(100dvh - 136px);
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-copy-panel {
    display: none;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
    position: relative;
    overflow: hidden;
    min-height: 100%;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.14);
  }

  body[data-page="portal"]:not(.portal-logged-in) .portal-login-logo-wrap-inline {
    display: none;
  }

  .mobile-login-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: #f0eeea;
    margin-bottom: 10px;
  }

  .mobile-login-tab {
    flex: 1 1 0;
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #777777;
    font-size: 0.82rem;
    font-weight: 700;
  }

  .mobile-login-tab.is-active {
    background: #c0002a;
    color: #ffffff;
  }

  .mobile-login-panel {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 58px;
    bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateX(18px);
    pointer-events: none;
    transition: transform 300ms ease, opacity 300ms ease;
  }

  .mobile-login-panel.hidden {
    display: flex !important;
  }

  .mobile-login-signin {
    transform: translateX(0);
  }

  .mobile-login-about {
    transform: translateX(18px);
  }

  body.mobile-login-about-open .mobile-login-signin {
    opacity: 0;
    transform: translateX(-18px);
    pointer-events: none;
  }

  body.mobile-login-about-open .mobile-login-about {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
  }

  body:not(.mobile-login-about-open) .mobile-login-signin {
    opacity: 1;
    pointer-events: auto;
  }

  body:not(.mobile-login-about-open) .mobile-login-about {
    opacity: 0;
    pointer-events: none;
  }

  .mobile-login-signin .panel-header {
    margin: 0;
    padding: 0;
  }

  .mobile-login-signin .section-tag,
  .mobile-login-about .section-tag {
    font-size: 0.68rem;
    letter-spacing: 0.18em;
  }

  .mobile-login-signin h2 {
    font-size: 1.3rem;
    line-height: 1.05;
  }

  .mobile-login-about h2 {
    font-size: 1.12rem;
    line-height: 1.08;
    margin: 0;
  }

  .mobile-login-signin .gate-intro,
  .mobile-login-about .gate-intro {
    font-size: 0.82rem;
    line-height: 1.24;
    margin: 0;
  }

  .mobile-login-signin .gate-form {
    gap: 10px;
  }

  .mobile-login-signin label {
    font-size: 0.86rem;
  }

  .mobile-login-signin input {
    min-height: 46px;
    border-radius: 12px;
  }

  .mobile-login-signin .button {
    min-height: 46px;
    border-radius: 999px;
  }

  .mobile-login-signin .helper-text {
    margin: 0;
    font-size: 0.76rem;
    font-style: italic;
  }

  .mobile-login-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-login-stat-card {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #e2e2e2;
    background: #ffffff;
  }

  .mobile-login-stat-card strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 2px;
  }

  .mobile-login-stat-card span {
    display: block;
    font-size: 0.72rem;
    color: #777777;
    line-height: 1.2;
  }

  .mobile-login-value-list {
    display: grid;
    gap: 8px;
  }

  .mobile-login-value-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #ece7e1;
    background: rgba(255, 255, 255, 0.8);
  }

  .mobile-login-value-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fdf0f0;
  }

  .mobile-login-value-icon i {
    color: #c0002a;
    font-size: 0.92rem;
  }

  .mobile-login-value-row strong {
    display: block;
    font-size: 0.94rem;
    line-height: 1.1;
  }

  .mobile-login-value-row p {
    margin: 2px 0 0;
    font-size: 0.76rem;
    line-height: 1.2;
    color: #777777;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-footer {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 2px 10px 0;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
    z-index: 2;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-footer-links {
    display: none;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-row {
    display: none !important;
  }

  body[data-page="portal"].portal-logged-in .mobile-pagebar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin: 0;
    background: #ffffff;
    border-top: 1px solid #ece7e1;
    border-bottom: 1px solid #e3ddd7;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 22;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .mobile-pagebar {
    background: #1e1e1e;
    border-top-color: #2a2a2a;
    border-bottom-color: #2a2a2a;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  }

  body[data-page="portal"].portal-logged-in .mobile-menu-toggle {
    display: grid !important;
    width: 38px;
    height: 38px;
    border: 0;
    padding: 0;
    border-radius: 10px;
    background: transparent;
    place-items: center;
    gap: 3px;
  }

  body[data-page="portal"].portal-logged-in .mobile-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #cbbca6;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .mobile-menu-toggle span {
    background: #f0f0f0;
  }

  .mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 55;
  }

  body.mobile-drawer-open .mobile-drawer-overlay {
    display: block !important;
  }

  .portal-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    position: relative;
    min-height: 0;
    padding: 12px;
  }

  .portal-layout > .content-stack {
    width: 100%;
    padding: 0;
  }

  .portal-layout > .content-stack > .panel {
    margin: 0 0 12px;
    border-radius: 16px;
  }

  .portal-layout > .content-stack > .panel:last-child {
    margin-bottom: 0;
  }

  .portal-layout > .sidebar,
  .portal-layout > .sidebar.panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 25vw;
    max-width: 25vw;
    min-width: 25vw;
    height: 100dvh;
    margin: 0;
    padding: 42px 6px 14px;
    background: #1c1c1e !important;
    color: rgba(255, 255, 255, 0.92);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 240ms ease;
    z-index: 60;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.38);
    display: flex !important;
    flex-direction: column;
    align-items: center;
  }

  body.mobile-drawer-open .portal-layout > .sidebar,
  body.mobile-drawer-open .portal-layout > .sidebar.panel {
    transform: translateX(0);
  }

  .sidebar-mobile-close {
    display: grid;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.78);
    place-items: center;
    z-index: 1;
  }

  .sidebar-logo-block {
    width: 100%;
    min-height: 60px;
    padding: 0;
    justify-content: center;
    align-items: center;
  }

  .sidebar-logo-img {
    width: 48px;
    max-height: 48px;
    margin: 0 auto;
    object-fit: contain;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  .identity-strip {
    width: 100%;
    text-align: center;
    justify-items: center;
    padding: 8px 6px;
    border-radius: 12px;
  }

  .sidebar-nav {
    width: 100%;
    display: grid !important;
    gap: 6px;
    padding: 0;
    margin-top: 0;
  }

  .sidebar-nav button {
    width: 100%;
    min-height: 40px;
    padding: 6px 4px;
    justify-content: center;
    gap: 4px;
    border-radius: 12px;
  }

  .sidebar-nav button span:last-child {
    font-size: 0.56rem;
    line-height: 1.05;
    text-align: center;
  }

  .nav-item-icon {
    font-size: 0.78rem;
  }

  .sidebar-bottom-actions {
    width: 100%;
    gap: 8px;
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-profile-copy {
    display: none;
  }

  .sidebar-profile-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
  }

  .sidebar-quick-action {
    width: 100%;
    min-height: 42px;
    padding: 8px 8px;
    border-radius: 12px;
  }

  .theme-switch-wrapper {
    width: 100%;
  }

  .portal-layout > .content-stack > .panel,
  .panel {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
  }

  body.theme-dark .portal-layout > .content-stack > .panel,
  body.theme-dark .panel {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
  }
}

body.theme-dark {
  --bg: #111111;
  --bg-soft: #171717;
  --panel: rgba(34, 34, 34, 0.96);
  --panel-strong: #2a2a2a;
  --line: rgba(255, 255, 255, 0.07);
  --text: #f5f2ee;
  --muted: #c5beb7;
  --gold-soft: rgba(216, 166, 59, 0.2);
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(181, 31, 59, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(216, 166, 59, 0.18), transparent 28%),
    linear-gradient(160deg, var(--bg-soft), var(--bg) 55%, var(--bg));
  transition: background 180ms ease, color 180ms ease;
}

.login-slideshow {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  filter: saturate(1.05);
}

.login-slide,
.login-slideshow-overlay {
  position: absolute;
  inset: 0;
}

.login-slide {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0;
  transform: scale(1.03);
  animation: login-fade 36s infinite ease-in-out;
}

.login-slideshow-overlay {
  background:
    linear-gradient(135deg, rgba(17, 17, 17, 0.48), rgba(17, 17, 17, 0.2)),
    radial-gradient(circle at center, rgba(181, 31, 59, 0.14), transparent 55%);
}

.login-slide-1 {
  background-image: url("metro1.jpg");
  animation-delay: 0s;
}

.login-slide-2 {
  background-image: url("metro2.jpg");
  animation-delay: 6s;
}

.login-slide-3 {
  background-image: url("metro3.jpg");
  animation-delay: 12s;
}

.login-slide-4 {
  background-image: url("metro4.jpg");
  animation-delay: 18s;
}

.login-slide-5 {
  background-image: url("metro5.jpg");
  animation-delay: 24s;
}

.login-slide-6 {
  background-image: url("metro6.jpg");
  animation-delay: 30s;
}

body.portal-logged-in .login-slideshow {
  display: none;
}

body[data-page="portal"]:not(.theme-dark) .login-slide {
  filter: saturate(1.02) brightness(0.95);
}

body[data-page="portal"]:not(.theme-dark) .login-slideshow-overlay {
  background:
    linear-gradient(135deg, rgba(12, 18, 28, 0.34), rgba(20, 28, 40, 0.22)),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.18), transparent 58%);
}

body.theme-dark[data-page="portal"] .login-slide {
  filter: saturate(0.9) brightness(0.62) contrast(1.06);
}

body.theme-dark[data-page="portal"] .login-slideshow-overlay {
  background:
    linear-gradient(135deg, rgba(5, 5, 8, 0.8), rgba(16, 12, 14, 0.52)),
    radial-gradient(circle at top, rgba(181, 31, 59, 0.18), transparent 60%);
}

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

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

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 48px;
  position: relative;
  z-index: 1;
}

body[data-page="portal"] .shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 72px;
}

.brandbar,
.panel-header,
.action-row,
.assignment-card header,
.report-card header,
.download-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.report-hero-name {
  font-family: "Montserrat", sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.report-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.brandbar {
  margin-bottom: 6px;
  align-items: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.portal-brandbar {
  position: relative;
  min-height: 90px;
  padding: 12px 20px 12px;
  border-radius: 34px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(252, 246, 240, 0.72));
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow:
    0 18px 45px rgba(17, 17, 17, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.home-brandbar {
  margin-bottom: 20px;
}

.brandmark,
.header-actions {
  display: flex;
  gap: 18px;
  align-items: center;
}

.brandmark {
  grid-column: 1;
  justify-self: start;
}

.portal-brandbar .header-actions {
  grid-column: 3;
  justify-self: end;
  align-self: center;
}

.portal-header-actions {
  padding: 0;
  gap: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  position: relative;
}

.portal-brandbar {
  grid-template-rows: auto auto;
  row-gap: 4px;
}

.portal-brandbar .brandmark {
  grid-column: 1;
  grid-row: 1 / span 2;
}

body[data-page="portal"] .brandmark {
  align-items: center;
}

body[data-page="portal"] .header-actions {
  align-self: center;
  padding-top: 0;
}

.header-actions {
  grid-column: 3;
  justify-self: end;
}

.portal-login-greeting {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
  justify-self: center;
  align-self: center;
  width: 100%;
  display: grid;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  padding-inline: 10px;
}

.portal-login-greeting .section-tag {
  margin: 0;
  text-align: center;
}

.login-ghost-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.portal-login-greeting h1 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(1.4rem, 2.4vw, 3rem);
  line-height: 0.86;
  font-weight: 900;
  letter-spacing: -0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(101, 14, 29, 0.94);
  text-shadow: 0 10px 28px rgba(181, 31, 59, 0.14);
  font-size: clamp(1.8rem, 3.0vw, 3.8rem);
}

.portal-login-greeting p:last-child {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(0.9rem, 1.1vw, 1.15rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(101, 14, 29, 0.88);
}

.login-ghost-primary {
  font-size: clamp(1.8rem, 3.0vw, 3.8rem);
  line-height: 0.96;
}

.login-ghost-secondary {
  font-size: clamp(0.7rem, 0.9vw, 0.9rem);
  line-height: 1.1;
  letter-spacing: 0.3em;
}

.login-ghost-cursor {
  display: inline-block;
  opacity: 0;
  color: rgba(101, 14, 29, 0.82);
  animation: ghost-cursor-blink 900ms steps(2, start) infinite;
  transform: translateY(-2px);
}

.login-ghost-cursor.is-visible {
  opacity: 1;
}

body.theme-dark .login-ghost-cursor {
  color: rgba(255, 255, 255, 0.86);
}

.portal-login-greeting h1,
.portal-login-greeting p:last-child {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
}

.portal-ghost-canvas {
  grid-column: 1 / span 2;
  grid-row: 2;
  justify-self: stretch;
  align-self: center;
  display: grid;
  place-items: center;
  min-height: 44px;
  padding-inline: 10px;
  pointer-events: none;
  z-index: 0;
  position: relative;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.ghost-stack {
  width: 100%;
  max-width: 100%;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  overflow: hidden;
}

.ghost-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.ghost-primary {
  font-family: "Montserrat", sans-serif;
  font-size: clamp(1.9rem, 4vw, 4.8rem);
  line-height: 0.92;
  font-weight: 900;
  letter-spacing: -0.075em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(163, 30, 51, 0.24);
}

.ghost-secondary {
  font-family: "Montserrat", sans-serif;
  font-size: clamp(0.68rem, 0.95vw, 0.92rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(163, 30, 51, 0.42);
}

body.theme-dark .portal-login-greeting h1,
body.theme-dark .ghost-primary {
  color: rgba(255, 255, 255, 0.14);
}

body.theme-dark .portal-login-greeting p:last-child,
body.theme-dark .ghost-secondary {
  color: rgba(255, 255, 255, 0.34);
}

.portal-header-actions {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
}

.portal-header-actions .icon-toggle,
.portal-header-actions .portal-profile-toggle {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow:
    0 12px 24px rgba(17, 17, 17, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

body.theme-dark .portal-header-actions .icon-toggle,
body.theme-dark .portal-header-actions .portal-profile-toggle {
  background: linear-gradient(135deg, rgba(35, 35, 39, 0.98), rgba(18, 18, 21, 0.96));
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.portal-notification-toggle,
.portal-theme-toggle,
.portal-profile-toggle {
  border-radius: 50%;
}

.ghost-line {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: "Montserrat", sans-serif;
  font-weight: 900;
  letter-spacing: -0.07em;
  line-height: 1;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  color: rgba(101, 14, 29, 0.9);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 520ms ease, transform 520ms ease;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.32);
}

.ghost-line-active {
  opacity: 1;
  transform: translateY(0);
}

.ghost-line-fading {
  opacity: 0;
  transform: translateY(-2px);
}

.ghost-primary {
  font-size: clamp(2.2rem, 4vw, 4.5rem);
}

.ghost-secondary {
  font-size: clamp(0.72rem, 0.82vw, 0.92rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(101, 14, 29, 0.88);
}

.ghost-cursor {
  display: inline-block;
  opacity: 0;
  color: rgba(101, 14, 29, 0.82);
  animation: ghost-cursor-blink 900ms steps(2, start) infinite;
  transform: translateY(-2px);
}

.ghost-cursor.is-visible {
  opacity: 1;
}

body.theme-dark .ghost-line {
  color: rgba(255, 255, 255, 0.84);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
}

body.theme-dark .ghost-secondary {
  color: rgba(255, 255, 255, 0.74);
}

body.theme-dark .ghost-cursor {
  color: rgba(255, 255, 255, 0.92);
}

.brandmark-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.brandmark-button:hover {
  transform: translateY(-1px);
}

.portal-brandmark {
  width: 108px;
  justify-self: center;
  justify-content: center;
  gap: 0;
  padding: 7px;
  min-height: 108px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 1)),
    var(--panel);
  border: 1px solid rgba(17, 17, 17, 0.06);
  box-shadow:
    0 12px 26px rgba(17, 17, 17, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  position: relative;
  overflow: hidden;
}

.portal-notification-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: visible;
}

.portal-notification-toggle span[aria-hidden="true"] {
  font-size: 0;
  line-height: 0;
}

.portal-notification-toggle::before {
  content: "\1F514";
  position: relative;
  z-index: 1;
  font-size: 1.12rem;
  line-height: 1;
  display: grid;
  place-items: center;
}

.notification-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--maroon);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 16px rgba(17, 17, 17, 0.24);
  z-index: 2;
}

.personal-progress {
  min-width: 0;
  flex: 0 1 auto;
  align-self: center;
  position: relative;
}

.personal-progress-dropdown {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
}

.personal-progress-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: visible;
  border: 1px solid var(--line);
  background: rgba(255, 241, 241, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.personal-progress-toggle:hover {
  transform: translateY(-1px);
}

.personal-progress-toggle.active-mode {
  box-shadow: 0 8px 16px rgba(181, 31, 59, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.theme-dark .personal-progress-toggle {
  background: rgba(18, 18, 18, 0.95);
  border-color: rgba(255, 218, 92, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.theme-dark .personal-progress-toggle.active-mode {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.personal-progress-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(181, 31, 59, 0.12);
  color: #b51f3b;
  font-size: 0.92rem;
  flex-shrink: 0;
}

body.theme-dark .personal-progress-icon {
  background: rgba(255, 218, 92, 0.16);
  color: #ffd94a;
}

.personal-progress-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--maroon), var(--accent));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 16px rgba(17, 17, 17, 0.24);
  z-index: 2;
}

.personal-progress-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  z-index: 30;
}

.personal-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.personal-progress-head strong {
  font-family: "Montserrat", sans-serif;
}

.personal-progress-head span {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.personal-progress-positive {
  background: rgba(31, 122, 77, 0.14);
  color: var(--good);
}

.personal-progress-negative {
  background: rgba(181, 31, 59, 0.12);
  color: var(--maroon);
}

.personal-progress-neutral {
  background: rgba(216, 166, 59, 0.12);
  color: var(--accent);
}

.personal-progress-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.personal-progress-summary-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.06), rgba(216, 166, 59, 0.08));
}

.personal-progress-summary-card span {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.personal-progress-summary-card strong {
  font-family: "Montserrat", sans-serif;
  font-size: 1.08rem;
  line-height: 1;
  color: var(--text);
}

.personal-progress-bars {
  display: grid;
  gap: 10px;
}

.personal-progress-bar-row {
  display: grid;
  gap: 6px;
}

.personal-progress-bar-copy {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.personal-progress-bar-copy span {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.personal-progress-bar-copy strong {
  font-size: 0.78rem;
  color: var(--text);
}

.personal-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(181, 31, 59, 0.12);
  border: 1px solid rgba(181, 31, 59, 0.08);
}

.personal-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--maroon), var(--accent));
}

.personal-progress-track-secondary {
  background: rgba(216, 166, 59, 0.14);
  border-color: rgba(216, 166, 59, 0.12);
}

.personal-progress-track-secondary span {
  background: linear-gradient(90deg, var(--accent), #d7bf7a);
}

.portal-notification-toggle.has-notifications {
  animation: bell-vibrate 0.55s linear infinite;
}

@keyframes bell-vibrate {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-3px, 3px) rotate(-18deg); }
  20% { transform: translate(3px, -3px) rotate(18deg); }
  30% { transform: translate(-3px, 0) rotate(-12deg); }
  40% { transform: translate(3px, 3px) rotate(12deg); }
  50% { transform: translate(-3px, -3px) rotate(-18deg); }
  60% { transform: translate(3px, 3px) rotate(18deg); }
  70% { transform: translate(-3px, 0) rotate(-12deg); }
  80% { transform: translate(3px, 3px) rotate(12deg); }
  90% { transform: translate(-2px, -2px) rotate(-8deg); }
}

.announcement-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  border-radius: 22px;
  padding: 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 30;
  display: grid;
  gap: 12px;
}

.announcement-popover-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.announcement-popover-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.announcement-popover-kind {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(181, 31, 59, 0.08);
  color: var(--maroon);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.announcement-popover-head strong {
  font-family: "Montserrat", sans-serif;
}

.announcement-popover-head span,
.announcement-popover-item span,
.announcement-popover-empty {
  color: var(--muted);
}

.announcement-popover-list {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.announcement-popover-item {
  appearance: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.05), rgba(216, 166, 59, 0.06));
}

.announcement-popover-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(17, 17, 17, 0.08);
}

.announcement-popover-item strong {
  font-family: "Montserrat", sans-serif;
}

.announcement-popover-item p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.announcement-popover-actions {
  display: flex;
  justify-content: flex-end;
}

.reminder-sent-pill {
  background: rgba(31, 122, 77, 0.14);
  color: var(--good);
}

.portal-profile-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.profile-toggle-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.16), rgba(216, 166, 59, 0.16));
  background-size: cover;
  background-position: center;
  overflow: hidden;
  color: var(--text);
  font-family: "Montserrat", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(220px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  z-index: 16;
}

.profile-menu-item {
  width: 100%;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 240, 232, 0.92));
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
  text-align: left;
}

.profile-menu-item-danger {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.12), rgba(216, 166, 59, 0.08));
  color: var(--maroon-dark);
}

.portal-brandmark::before {
  content: none;
}

.portal-brandmark::after {
  content: none;
}

.brandmark-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow:
    0 14px 32px rgba(17, 17, 17, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  position: relative;
  overflow: hidden;
}

.brandmark-logo img {
  width: 108px;
  height: auto;
  display: block;
  border-radius: 12px;
  animation: logo-float 4.8s ease-in-out infinite;
  transform-origin: center;
}

.portal-brandmark .brandmark-logo {
  padding: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: none;
}

.portal-brandmark .brandmark-logo img {
  width: 76px;
  border-radius: 0;
  object-fit: contain;
  position: relative;
  z-index: 1;
  animation: none;
}

.portal-brandmark .brandmark-logo::after {
  content: none;
}

.brandmark-logo::after {
  content: "";
  position: absolute;
  inset: -35% auto auto -65%;
  width: 58%;
  height: 190%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
  transform: rotate(12deg);
  animation: logo-sheen 6.2s ease-in-out infinite;
  pointer-events: none;
}

.brand-title,
.hero-card h2,
.panel h2,
.gate-card h2,
.feature-tile h3,
.stat-card strong,
th,
.success-toast-card h3 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
}

.brand-title {
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

body[data-page="portal"] .brand-title {
  text-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
}

body[data-page="portal"] .brand-subtitle {
  color: #111111;
  text-shadow: none;
  font-weight: 600;
}

.brand-title-metro {
  color: #111111;
}

.brand-title-pulse {
  color: #f0c14b;
}

body.theme-dark .brand-title-metro {
  color: #ffffff;
}

body.theme-dark[data-page="portal"] .brand-title {
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.48);
}

body.theme-dark[data-page="portal"] .brand-subtitle {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.46);
}

.eyebrow,
.section-tag {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--maroon);
  font-weight: 700;
}

.nav-links,
.hero-grid,
.page-grid,
.dashboard-grid,
.feature-grid,
.stats-grid,
.form-grid,
.stack-list,
.bulk-form {
  display: grid;
  gap: 20px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-link,
.button,
.theme-toggle {
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  cursor: pointer;
}

.compact-button,
.icon-action {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.compact-button {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(17, 17, 17, 0.04);
}

.action-approve {
  background: rgba(31, 122, 77, 0.14);
  border-color: rgba(31, 122, 77, 0.24);
  color: var(--good);
}

.action-reject {
  background: rgba(179, 35, 35, 0.14);
  border-color: rgba(179, 35, 35, 0.24);
  color: var(--late);
}

.action-feedback {
  background: rgba(216, 166, 59, 0.28);
  border-color: rgba(216, 166, 59, 0.45);
  color: #111111;
}

.icon-action {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
}

.nav-link,
.theme-toggle {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.portal-theme-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(17, 17, 17, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(248, 248, 248, 0.98));
  box-shadow:
    0 12px 24px rgba(17, 17, 17, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.portal-theme-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow: none;
}

.portal-theme-toggle .theme-icon {
  position: relative;
  z-index: 1;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  color: #1f1f1f;
  transition: color 220ms ease, transform 220ms ease, opacity 220ms ease;
}

.portal-theme-toggle:hover {
  box-shadow:
    0 14px 28px rgba(17, 17, 17, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

body.theme-dark .portal-theme-toggle {
  background:
    linear-gradient(135deg, rgba(37, 37, 40, 0.98), rgba(23, 23, 26, 0.96));
  border-color: rgba(255, 255, 255, 0.12);
}

body.theme-dark .portal-theme-toggle::before {
  background: transparent;
}

body.theme-dark .portal-theme-toggle .theme-icon {
  color: rgba(255, 255, 255, 0.72);
}

body.theme-dark .nav-link,
body.theme-dark .theme-toggle,
body.theme-dark .brandmark-logo,
body.theme-dark .portal-brandbar {
  background: rgba(30, 30, 30, 0.96);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.theme-dark .portal-brandmark {
  background:
    linear-gradient(135deg, rgba(24, 24, 26, 0.98), rgba(17, 17, 19, 0.94)),
    var(--panel);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(181, 31, 59, 0.2),
    0 18px 42px rgba(0, 0, 0, 0.45),
    0 0 36px rgba(181, 31, 59, 0.14);
}

body.theme-dark .portal-brandmark::before {
  opacity: 1;
}

body.theme-dark .portal-brandmark .brandmark-logo {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(181, 31, 59, 0.04)),
    rgba(255, 255, 255, 0.03);
}

body.theme-dark .portal-brandmark .brandmark-logo::after {
  opacity: 0.38;
}

body.theme-dark .portal-brandbar {
  background: linear-gradient(135deg, rgba(24, 24, 27, 0.96), rgba(18, 18, 20, 0.92));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.theme-dark .portal-ghost-canvas {
  background: transparent;
}

body.theme-dark .portal-header-actions .portal-theme-toggle {
  background:
    linear-gradient(135deg, rgba(40, 40, 44, 0.98), rgba(20, 20, 23, 0.96));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 12px 22px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-dark .portal-header-actions .portal-theme-toggle::before {
  background: transparent;
}

.nav-link:hover,
.button:hover,
.theme-toggle:hover,
.compact-button:hover,
.icon-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(17, 17, 17, 0.1);
}

body.theme-dark .nav-link:hover,
body.theme-dark .button:hover,
body.theme-dark .theme-toggle:hover,
body.theme-dark .compact-button:hover,
body.theme-dark .icon-action:hover {
  background: var(--gold);
  color: var(--black);
  border-color: transparent;
}

.nav-link-accent,
.button {
  color: #fff;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  border-color: transparent;
}

.button-secondary {
  background: linear-gradient(135deg, #111111, #303030);
}

.export-dropdown {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
  min-width: 168px;
}

.export-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 148px;
}

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: 188px;
  max-height: min(78vh, 420px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
}

.export-menu-item {
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.export-menu-item:hover,
.export-menu-item:focus-visible {
  outline: none;
  background: rgba(181, 31, 59, 0.1);
  color: var(--maroon);
}

.export-menu-item i {
  width: 18px;
  text-align: center;
}

.hero-grid {
  grid-template-columns: 1.35fr 1fr;
  margin-bottom: 24px;
}

.page-grid {
  grid-template-columns: 1.45fr 0.95fr;
}

.dashboard-grid {
  grid-template-columns: 1.2fr 1fr;
  align-items: start;
}

.feature-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

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

.stats-grid {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.bulk-form {
  gap: 14px;
}

.hero-card,
.panel,
.gate-card,
.stat-card,
.feature-panel,
.modal-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.hero-card-primary {
  background:
    linear-gradient(135deg, rgba(181, 31, 59, 0.08), rgba(216, 166, 59, 0.18)),
    var(--panel);
}

.feature-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 247, 234, 0.92)),
    var(--panel);
}

body.theme-dark .feature-panel,
body.theme-dark .hero-card-primary {
  background:
    linear-gradient(135deg, rgba(181, 31, 59, 0.16), rgba(216, 166, 59, 0.14)),
    var(--panel);
}

.feature-tile,
.assignment-card,
.report-card,
.identity-strip,
.format-box {
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  padding: 16px;
}

.identity-strip {
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(216, 166, 59, 0.12), rgba(181, 31, 59, 0.06));
  font-weight: 700;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
}

.format-box {
  margin: 0 0 14px;
  white-space: pre-wrap;
  font-family: Consolas, monospace;
  overflow-x: auto;
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.download-footer {
  margin-top: 18px;
  align-items: center;
}

.panel-wide,
.full-span {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 14px 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.95);
}

body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select {
  background: rgba(31, 31, 31, 0.98);
  border-color: rgba(255, 255, 255, 0.05);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

.helper-text,
.hero-card p,
.panel p,
.feature-tile p,
.gate-card p,
.stat-card span,
.empty-state,
small {
  color: var(--muted);
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.history-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.history-status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 9px;
}

.status-pending {
  background: rgba(216, 166, 59, 0.14);
  color: #9f6b02;
}

.status-holiday {
  background: rgba(31, 122, 77, 0.12);
  color: #1f7a4d;
}

.status-pending::before {
  background: var(--gold);
}

.status-holiday::before {
  background: #1f7a4d;
}

.status-approved {
  background: rgba(31, 122, 77, 0.12);
  color: var(--good);
}

.status-approved::before {
  background: var(--good);
}

.status-declined {
  background: rgba(179, 35, 35, 0.12);
  color: var(--late);
}

.status-declined::before {
  background: var(--late);
}

.status-pill {
  background: var(--gold-soft);
  color: var(--maroon-dark);
  white-space: nowrap;
}

body.theme-dark #taskList .status-pill {
  color: #ffffff;
}

.badge-submitted {
  background: rgba(31, 122, 77, 0.12);
  color: var(--good);
}

.badge-late {
  background: rgba(179, 35, 35, 0.12);
  color: var(--late);
}

body.theme-dark .badge-late {
  background: rgba(140, 27, 27, 0.5);
  color: #ffd3d3;
}

.badge-pending {
  background: rgba(17, 17, 17, 0.08);
  color: var(--muted);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.gate-card {
  width: min(560px, calc(100% - 24px));
  margin: 0 auto 36px;
  padding: 24px 28px 26px;
  border-radius: 34px;
  background:
    linear-gradient(180deg, #F2E9D0, #F2E9D0),
    #F2E9D0;
  border: 1px solid rgba(17, 17, 17, 0.07);
  box-shadow:
    0 28px 66px rgba(17, 17, 17, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  position: relative;
  overflow: hidden;
}

.gate-form {
  display: grid;
  gap: 15px;
}

.gate-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 28px;
  border: 1px solid rgba(17, 17, 17, 0.04);
  pointer-events: none;
}

.gate-card::after {
  content: "";
  position: absolute;
  inset: auto -16% -42px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(181, 31, 59, 0.08), transparent 65%);
  pointer-events: none;
}

.gate-card .panel-header {
  display: grid;
  justify-items: center;
  align-items: start;
  margin-bottom: 24px;
  text-align: center;
}

.gate-card .panel-header > div {
  width: 100%;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.gate-card h2 {
  width: 100%;
  display: block;
  text-align: center;
  line-height: 1.1;
  max-width: 100%;
  margin-inline: auto;
}

.gate-card .section-tag {
  font-variant: small-caps;
  letter-spacing: 0.34em;
  text-align: center;
  font-weight: 800;
  margin-bottom: 16px;
}

.gate-intro {
  margin: 8px 0 0;
  max-width: 100%;
  font-size: 1rem;
  margin-inline: auto;
  text-align: center;
}

.gate-card label {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.gate-card input {
  background: #ffffff;
  border: 1px solid rgba(17, 17, 17, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
  padding: 18px 24px;
}

.gate-card input::placeholder {
  color: rgba(17, 17, 17, 0.45);
  opacity: 1;
}

.gate-card .button {
  min-height: 52px;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #c61f3f, #a51632 58%, #861125);
  box-shadow: 0 16px 30px rgba(198, 31, 63, 0.26);
  width: 100%;
}

.gate-card .helper-text {
  margin: 4px 0 0;
  font-family: "Source Sans 3", sans-serif;
  font-style: italic;
  color: var(--muted);
  text-align: center;
}

.gate-card .section-tag {
  font-size: 0.72rem;
  letter-spacing: 0.26em;
}

body.theme-dark .gate-card {
  background:
    linear-gradient(180deg, rgba(25, 25, 28, 0.84), rgba(16, 16, 19, 0.8)),
    rgba(11, 11, 14, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 26px 66px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(181, 31, 59, 0.08);
}

body.theme-dark .gate-card::before {
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .gate-card::after {
  background: radial-gradient(circle, rgba(181, 31, 59, 0.12), transparent 64%);
}

body.theme-dark .gate-card input {
  background: rgba(18, 18, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(181, 31, 59, 0.08);
  padding: 18px 24px;
}

body.theme-dark .gate-card input::placeholder {
  color: rgba(255, 255, 255, 0.48);
  opacity: 1;
}

body.theme-dark .gate-card .button {
  background: linear-gradient(135deg, #c61f3f, #a51632 52%, #861125);
  box-shadow:
    0 18px 34px rgba(198, 31, 63, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

body.theme-dark .gate-intro {
  color: rgba(255, 255, 255, 0.78);
}

body.theme-dark .gate-card .helper-text {
  color: rgba(255, 255, 255, 0.58);
}

.gate-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gate-layout {
  width: min(1200px, 100%);
  margin: 0;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.85fr);
  gap: 16px;
  align-items: stretch;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.46), rgba(255, 250, 246, 0.38));
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow:
    0 26px 64px rgba(17, 17, 17, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.gate-layout::before,
.gate-layout::after {
  content: none;
}

.gate-copy-panel,
.gate-auth-panel {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 26px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(252, 248, 244, 0.86));
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow:
    0 18px 38px rgba(17, 17, 17, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  overflow: hidden;
}

.gate-copy-panel {
  isolation: isolate;
}

.foundation-highlight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.foundation-highlight-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(17,17,17,0.06);
}

.foundation-highlight-item strong {
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.foundation-highlight-item span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.gate-copy-panel::before {
  content: "";
  position: absolute;
  inset: 18px;
  background: url("metro-group-logo.jpeg") center center / contain no-repeat;
  opacity: 0.06;
  filter: grayscale(1) brightness(1.05);
  pointer-events: none;
  z-index: 0;
}

.gate-copy-panel > * {
  position: relative;
  z-index: 1;
}

.gate-copy-panel::after,
.gate-auth-panel::after {
  content: "";
  position: absolute;
  inset: auto -10% -60px auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(181, 31, 59, 0.08), transparent 66%);
  pointer-events: none;
}

.gate-copy-panel .section-tag,
.gate-auth-panel .section-tag {
  text-align: left;
  margin: 0;
}

.gate-copy-panel h2 {
  margin: 0;
  text-align: left;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.95rem, 2.3vw, 3rem);
  line-height: 0.92;
  letter-spacing: -0.025em;
}

.gate-copy-panel .gate-intro,
.gate-auth-panel .gate-intro {
  margin: 0;
  text-align: left;
  margin-inline: 0;
  max-width: 46ch;
  line-height: 1.38;
  font-size: 0.94rem;
}

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

.foundation-pillar-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.foundation-pillar-card strong {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

.foundation-pillar-card p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.foundation-pillar-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 0;
  color: transparent;
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.12), rgba(216, 166, 59, 0.12));
  border: 1px solid rgba(17, 17, 17, 0.06);
  position: relative;
  overflow: hidden;
}

.foundation-pillar-card:nth-child(1) .foundation-pillar-icon::before,
.foundation-pillar-card:nth-child(2) .foundation-pillar-icon::before,
.foundation-pillar-card:nth-child(3) .foundation-pillar-icon::before,
.foundation-pillar-card:nth-child(4) .foundation-pillar-icon::before {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--maroon-dark);
}

.foundation-pillar-card:nth-child(1) .foundation-pillar-icon::before {
  content: "🤝";
}

.foundation-pillar-card:nth-child(2) .foundation-pillar-icon::before {
  content: "🫂";
}

.foundation-pillar-card:nth-child(3) .foundation-pillar-icon::before {
  content: "💡";
}

.foundation-pillar-card:nth-child(4) .foundation-pillar-icon::before {
  content: "🛡";
}

.foundation-pillar-card strong {
  font-size: 1.02rem;
}

.foundation-pillar-card p {
  font-size: 0.98rem;
}

.gate-auth-panel .panel-header {
  justify-items: start;
  align-items: start;
  text-align: left;
  margin-bottom: 4px;
}

.gate-auth-panel .panel-header > div {
  justify-items: start;
  text-align: left;
}

.gate-auth-panel h2 {
  width: auto;
  text-align: left;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.7rem, 2vw, 2.35rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
}

.gate-auth-panel .gate-form {
  gap: 14px;
}

.gate-auth-panel label {
  display: grid;
  gap: 8px;
}

.gate-auth-panel .helper-text {
  text-align: left;
}

.gate-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 0 8px 6px;
  color: var(--muted);
  font-size: 0.92rem;
  width: min(1280px, 100%);
  margin: 0 auto;
  justify-content: center;
  text-align: center;
  padding: 4px 12px 8px;
  margin-top: auto;
}

.gate-footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.gate-footer-links a {
  color: var(--text);
  opacity: 0.72;
}

body.theme-dark .gate-layout {
  background: linear-gradient(135deg, rgba(26, 26, 30, 0.74), rgba(17, 17, 20, 0.68));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.theme-dark .gate-copy-panel,
body.theme-dark .gate-auth-panel {
  background: linear-gradient(180deg, rgba(34, 34, 38, 0.92), rgba(24, 24, 27, 0.88));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.theme-dark .foundation-pillar-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .foundation-pillar-icon {
  color: #f5f2ee;
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .gate-footer a {
  color: rgba(255, 255, 255, 0.84);
}

.empty-state {
  min-height: 160px;
  place-items: center;
  text-align: center;
}

.stat-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 242, 0.9)),
    var(--panel);
}

body.theme-dark .stat-card {
  background:
    linear-gradient(135deg, rgba(36, 36, 36, 0.92), rgba(29, 29, 29, 0.9)),
    var(--panel);
}

.stat-card strong {
  font-size: 2rem;
}

.modal-overlay,
.success-toast {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.4);
  z-index: 20;
}

.modal-card {
  width: min(760px, 100%);
}

.modal-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.track-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.active-mode {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  border-color: transparent;
}

.alert-card {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed var(--gold);
  background: var(--gold-soft);
  color: var(--text);
  font-weight: 700;
}

.panel-inline {
  margin-top: 20px;
}

.report-point-new {
  margin: 0;
  font-weight: 700;
}

body.theme-dark .status-pending {
  background: rgba(216, 166, 59, 0.18);
  color: #ffd66a;
}

body.theme-dark .status-approved {
  background: rgba(31, 122, 77, 0.24);
  color: #9cf0bf;
}

body.theme-dark .status-holiday {
  background: rgba(31, 122, 77, 0.24);
  color: #9cf0bf;
}

body.theme-dark .status-declined {
  background: rgba(179, 35, 35, 0.28);
  color: #ffd3d3;
}

/* ====================================================
   PORTAL OUTER SHELL — new full-width layout
   ==================================================== */
.portal-outer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Full-width topbar: ghost text left, bell right */
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.86), rgba(252,246,240,0.9));
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  position: sticky;
  top: 0;
  z-index: 12;
  min-height: 64px;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 18px rgba(17,17,17,0.07);
}

body.theme-dark .portal-topbar {
  background: linear-gradient(135deg, rgba(26,26,28,0.98), rgba(20,20,22,0.96));
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 4px 18px rgba(0,0,0,0.32);
}

.portal-topbar-ghost {
  flex: 1 1 auto;
  min-width: 0;
  pointer-events: none;
}

.portal-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  flex-shrink: 0;
  overflow: visible;
}

.submission-heatmap {
  min-width: 0;
  flex: 0 1 auto;
  align-self: center;
  position: relative;
}

.submission-heatmap-dropdown {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
}

.submission-heatmap-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: min(100%, 600px);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 241, 241, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.submission-heatmap-toggle:hover {
  transform: translateY(-1px);
}

body.theme-dark .submission-heatmap-toggle {
  background: rgba(18, 18, 18, 0.95);
  border-color: rgba(255, 218, 92, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.submission-heatmap-toggle-collapsed {
  min-width: 172px;
}

.submission-heatmap-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.submission-heatmap-copy strong {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 0.96rem;
  line-height: 1;
  color: var(--text);
}

.submission-heatmap-copy span {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

body.theme-dark .submission-heatmap-copy strong {
  color: rgba(255, 255, 255, 0.92);
}

body.theme-dark .submission-heatmap-copy span {
  color: rgba(255, 255, 255, 0.62);
}

.submission-heatmap-toggle-copy {
  margin-left: auto;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.submission-heatmap-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(181, 31, 59, 0.12);
  color: #b51f3b;
  font-size: 0.9rem;
  flex-shrink: 0;
}

body.theme-dark .submission-heatmap-icon {
  background: rgba(255, 218, 92, 0.16);
  color: #ffd94a;
}

.submission-heatmap-panel {
  position: fixed;
  top: 78px;
  right: 20px;
  display: grid;
  gap: 10px;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 247, 247, 0.98);
  overflow: visible;
  width: min(640px, calc(100vw - 24px));
  max-width: min(640px, calc(100vw - 24px));
  box-shadow: var(--shadow);
  z-index: 40;
  transform-origin: top right;
  animation: submission-heatmap-pop 180ms ease-out;
}

body.theme-dark .submission-heatmap-panel {
  background: rgba(15, 15, 15, 0.98);
  border-color: rgba(255, 218, 92, 0.14);
}

@keyframes submission-heatmap-pop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.submission-heatmap-months {
  display: grid;
  gap: 6px;
}

.submission-heatmap-statline {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.submission-heatmap-stat {
  display: grid;
  gap: 1px;
}

.submission-heatmap-stat strong {
  font-size: 1rem;
  line-height: 1;
  color: var(--text);
}

.submission-heatmap-stat span {
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.submission-heatmap-month-strip {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 2px;
}

.submission-heatmap-month-block {
  display: grid;
  gap: 8px;
  flex: 0 0 auto;
}

.submission-heatmap-month-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.68rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 2px;
}

.submission-heatmap-month-header strong {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--text);
  white-space: nowrap;
}

.submission-heatmap-month-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  gap: 4px;
  align-items: start;
}

.submission-heatmap-cell {
  position: relative;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: rgba(181, 31, 59, 0.14);
  outline: 1px solid rgba(181, 31, 59, 0.1);
}

.submission-heatmap-cell:hover {
  transform: scale(1.12);
  z-index: 5;
}

.submission-heatmap-cell::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  top: auto;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(17, 17, 17, 0.94);
  color: #ffffff;
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 2;
}

.submission-heatmap-cell[data-tooltip-position="below"]::after {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateX(-50%) translateY(-4px);
}

.submission-heatmap-cell:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.submission-heatmap-cell[data-tooltip-position="below"]:hover::after {
  transform: translateX(-50%) translateY(0);
}

.submission-heatmap-empty {
  background: rgba(181, 31, 59, 0.05);
  outline-color: rgba(181, 31, 59, 0.04);
}

.submission-heatmap-level-0 {
  background: rgba(181, 31, 59, 0.16);
}

.submission-heatmap-level-1 {
  background: rgba(172, 24, 42, 0.34);
}

.submission-heatmap-level-2 {
  background: rgba(150, 17, 34, 0.54);
}

.submission-heatmap-level-3 {
  background: rgba(120, 10, 23, 0.76);
}

.submission-heatmap-level-4 {
  background: rgba(82, 6, 16, 0.94);
}

.submission-heatmap-holiday {
  display: inline-grid;
  place-items: center;
  background: rgba(31, 122, 77, 0.22);
  color: #1f7a4d;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

body.theme-dark .submission-heatmap-cell {
  background: rgba(255, 220, 92, 0.1);
  outline-color: rgba(255, 220, 92, 0.08);
}

body.theme-dark .submission-heatmap-empty {
  background: rgba(255, 220, 92, 0.05);
  outline-color: rgba(255, 220, 92, 0.05);
}

body.theme-dark .submission-heatmap-cell::after {
  background: rgba(250, 210, 70, 0.96);
  color: #161616;
}

body.theme-dark .submission-heatmap-level-1 {
  background: rgba(255, 232, 128, 0.24);
}

body.theme-dark .submission-heatmap-level-2 {
  background: rgba(255, 217, 76, 0.44);
}

body.theme-dark .submission-heatmap-level-3 {
  background: rgba(245, 190, 48, 0.68);
}

body.theme-dark .submission-heatmap-level-4 {
  background: rgba(214, 159, 27, 0.98);
}

body.theme-dark .submission-heatmap-holiday {
  background: rgba(63, 185, 124, 0.28);
  color: #8ff0b9;
}

@media (max-width: 768px) {
  .submission-heatmap {
    display: block;
  }

  .submission-heatmap-toggle {
    min-width: 0;
    padding: 6px 9px;
    gap: 7px;
    border-radius: 14px;
  }

  .submission-heatmap-toggle-collapsed {
    min-width: 0;
  }

  .submission-heatmap-copy span,
  .submission-heatmap-toggle-copy {
    display: none;
  }

  .submission-heatmap-copy strong {
    font-size: 0.82rem;
  }

  .submission-heatmap-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 0.8rem;
  }

  .submission-heatmap-panel {
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    padding: 10px;
    gap: 8px;
  }

  .submission-heatmap-stat strong {
    font-size: 0.92rem;
  }

  .submission-heatmap-month-strip {
    gap: 12px;
  }

  .submission-heatmap-month-grid {
    grid-template-rows: repeat(7, 9px);
    grid-auto-columns: 9px;
    gap: 3px;
  }

  .submission-heatmap-cell {
    width: 9px;
    height: 9px;
    border-radius: 2px;
  }

  .submission-heatmap-cell::after {
    font-size: 0.62rem;
    white-space: normal;
    max-width: 140px;
    text-align: center;
    padding: 5px 7px;
  }

  .submission-heatmap-month-header {
    font-size: 0.62rem;
  }

  .submission-heatmap-stat span {
    font-size: 0.58rem;
  }
  }

.portal-alerts-full {
  display: grid;
  gap: 14px;
  padding: 0 20px;
}

/* Two-column layout: sidebar + content */
.portal-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 16px 20px;
  flex: 1 1 auto;
}

body.sidebar-collapsed .portal-layout {
  grid-template-columns: 72px minmax(0, 1fr);
}

/* ====================================================
   SIDEBAR
   ==================================================== */
.portal-layout > .sidebar {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex !important;
  flex-direction: column;
  scrollbar-width: none;
  border-radius: 22px;
}

.portal-layout > .sidebar::-webkit-scrollbar { display: none; }

.portal-layout > .sidebar.panel {
  padding: 0;
  gap: 0;
}

/* Logo block at top */
.sidebar-logo-block {
  display: flex;
  justify-content: center;   /* center logo */
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo-img {
  width: 70px;     /* increased & clean size */
  height: auto;
  object-fit: contain;
}
.sidebar-logo-block img {
  background: none;
  box-shadow: none;
  border-radius: 0;
}

body.sidebar-collapsed .sidebar-logo-img {
  height: 28px;
}

/* Collapse toggle button — same size as nav icons */
.sidebar-collapse-toggle {
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  cursor: pointer;
  color: var(--text);
  transition: background 160ms ease;
}

.sidebar-collapse-toggle:hover {
  background: var(--gold-soft);
}

/* Identity strip */
.identity-strip {
  margin: 0;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(216,166,59,0.12), rgba(181,31,59,0.06));
  border-bottom: 1px solid var(--line);
}

/* Sidebar nav */
.sidebar-nav {
  display: grid;
  gap: 2px;
  flex: 1 1 auto;
  align-content: start;
  padding: 8px 8px 0;
}

.sidebar-nav button {
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.sidebar-nav button:hover {
  background: var(--gold-soft);
}

.sidebar-nav button.active-section {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
}

.nav-item-icon {
  font-size: 0.5rem;
  margin-right: 10px;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
}

body.sidebar-collapsed .nav-item-icon {
  margin-right: 0;
  font-size: 1.1rem;
}

body.sidebar-collapsed .sidebar-nav button span:not(.nav-item-icon) { display: none; }
body.sidebar-collapsed .sidebar-nav button { justify-content: center; padding-inline: 8px; }

/* Bottom actions — sticky to bottom, clear separator */
.sidebar-bottom-actions {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 10px 8px 12px;
  border-top: 1px solid var(--line);
}
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-nav .nav-item i {
  font-size: 16px;
  width: 20px;
  color: #666;
}

/* Active */
.sidebar-nav .nav-item.active {
  background: linear-gradient(135deg, #a51d2d, #7a1c2e);
  color: white;
}

.sidebar-nav .nav-item.active i {
  color: white;
}

/* Hover */
.sidebar-nav .nav-item:hover {
  background: #f3f3f3;
}

/* Theme switch */
.theme-switch-wrapper {
  display: flex;
  background: var(--line);
  border-radius: 14px;
  padding: 3px;
  gap: 2px;
}

.theme-switch-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--muted);
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.theme-switch-btn.is-active {
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(17,17,17,0.1);
}

body.theme-dark .theme-switch-btn.is-active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* Sidebar quick actions */
.sidebar-quick-action {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  font-size: 0.82rem;
  transition: background 140ms ease;
}

.sidebar-quick-action:hover {
  background: var(--gold-soft);
  border-color: rgba(181,31,59,0.18);
}

.sidebar-quick-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(181,31,59,0.08), rgba(216,166,59,0.16));
  font-size: 0.9rem;
  font-style: normal;
}

.sidebar-quick-copy {
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
}

.sidebar-profile-button.sidebar-quick-action {
  grid-template-columns: 28px 1fr;
}

.sidebar-profile-avatar {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

.sidebar-profile-copy {
  display: grid;
  gap: 1px;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.2;
}

/* Collapsed sidebar adjustments */
body.sidebar-collapsed .identity-strip { display: none; }
body.sidebar-collapsed .sidebar-quick-copy,
body.sidebar-collapsed .sidebar-profile-copy,
body.sidebar-collapsed .toggle-text { display: none; }
body.sidebar-collapsed .sidebar-quick-action {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-inline: 6px;
}
body.sidebar-collapsed .theme-switch-wrapper {
  flex-direction: column;
  padding: 3px;
}
body.sidebar-collapsed .sidebar-logo-block {
  justify-content: center;
}


.festival-banner {
  border-radius: 28px;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.12), rgba(216, 166, 59, 0.18)), var(--panel);
  border: 1px solid rgba(17, 17, 17, 0.08);
  box-shadow: var(--shadow);
}

.festival-banner .section-tag {
  margin-bottom: 8px;
}

.festival-banner h2 {
  margin: 0;
}

.festival-banner p {
  margin: 8px 0 0;
  color: var(--muted);
}

.metro-ticker {
  border-radius: 22px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  overflow: hidden;
}

.metro-ticker-track {
  display: flex;
  gap: 12px;
  animation: ticker-scroll 30s linear infinite;
  width: max-content;
}

.metro-ticker-item {
  min-width: 260px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.metro-ticker-item strong {
  display: block;
  margin-bottom: 6px;
  font-family: "Montserrat", sans-serif;
}

.broadcast-composer {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.broadcast-composer textarea {
  min-height: 96px;
}

.profile-form {
  display: grid;
  gap: 18px;
}

.profile-search-panel {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.06), rgba(216, 166, 59, 0.08)), var(--panel);
  box-shadow: var(--shadow);
}

.profile-search-form {
  display: flex;
  gap: 12px;
  align-items: end;
}

.profile-search-form label {
  flex: 1 1 auto;
}

.profile-search-form .button {
  min-width: 140px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

.profile-photo-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 243, 237, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.profile-photo-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 28px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.profile-photo-meta {
  display: grid;
  gap: 4px;
  text-align: center;
}

.profile-photo-meta strong {
  font-family: "Montserrat", sans-serif;
  font-size: 1.05rem;
}

.profile-photo-meta span {
  color: var(--muted);
  font-size: 0.92rem;
}

.profile-upload {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(17, 17, 17, 0.04);
  border: 1px dashed rgba(17, 17, 17, 0.12);
  font-weight: 700;
}

.profile-upload input {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
}

.profile-main-stack {
  display: grid;
  gap: 16px;
}

.profile-summary-card,
.profile-about-card,
.profile-activity-card,
.profile-edit-card,
.profile-achievements-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.profile-summary-head,
.profile-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.profile-summary-head h3,
.profile-card-header h3 {
  margin: 4px 0 0;
  font-family: "Montserrat", sans-serif;
  font-size: 1.4rem;
}

.profile-summary-head .helper-text {
  margin: 6px 0 0;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
}

.profile-stat {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.08), rgba(216, 166, 59, 0.12));
  border: 1px solid rgba(17, 17, 17, 0.06);
  text-align: center;
}

.profile-stat span {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.profile-stat strong {
  font-family: "Montserrat", sans-serif;
  font-size: 1.4rem;
}

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

.achievement-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.achievement-card-active {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.1), rgba(216, 166, 59, 0.12));
}

.achievement-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(181, 31, 59, 0.12);
  color: var(--maroon-dark);
  font-weight: 800;
  flex: 0 0 auto;
}

.achievement-card strong {
  display: block;
  font-family: "Montserrat", sans-serif;
}

.achievement-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.profile-edit-grid label {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.profile-edit-grid input {
  margin-top: 8px;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-info-item {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.profile-info-item span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.profile-info-item strong {
  font-family: "Montserrat", sans-serif;
  word-break: break-word;
}

.profile-bio textarea {
  min-height: 150px;
  padding-left: 18px;
  padding-right: 18px;
}

.profile-bio-editor textarea {
  width: 100%;
  min-height: 170px;
  margin-top: 10px;
}

.profile-bio-readonly {
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--text);
  line-height: 1.6;
}

.profile-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-profile {
  background: rgba(181, 31, 59, 0.1);
  color: var(--maroon-dark);
}

.identity-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-user-name {
  font-family: "Montserrat", sans-serif;
  font-size: clamp(1.1rem, 1.5vw, 1.7rem);
  line-height: 1.04;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sidebar-profile-button {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.06), rgba(216, 166, 59, 0.12)), var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.06);
}

.sidebar-profile-button:hover {
  transform: translateY(-1px);
}

.sidebar-profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background:
    linear-gradient(135deg, rgba(181, 31, 59, 0.18), rgba(216, 166, 59, 0.16)),
    #fff;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(17, 17, 17, 0.08);
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
}

.sidebar-profile-copy {
  display: grid;
  gap: 2px;
  text-align: left;
  min-width: 0;
}

.sidebar-profile-copy strong {
  font-family: "Montserrat", sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-copy span {
  color: var(--muted);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.nav-item-icon {
  width: 28px;
  display: inline-grid;
  place-items: center;
  font-size: 1.15rem;
  opacity: 0.92;
}

.profile-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.profile-link:hover {
  color: var(--maroon);
}

.profile-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.profile-actions .helper-text {
  margin: 0;
}

.activity-timeline {
  display: grid;
  gap: 12px;
  position: relative;
  padding-left: 14px;
}

.activity-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  position: relative;
}

.activity-item::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 48px;
  bottom: -14px;
  width: 2px;
  background: rgba(181, 31, 59, 0.14);
}

.activity-item:last-child::before {
  display: none;
}

.activity-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(181, 31, 59, 0.12);
  color: var(--maroon-dark);
  margin-top: 2px;
}

.activity-body {
  display: grid;
  gap: 10px;
}

.activity-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.activity-item header strong {
  font-family: "Montserrat", sans-serif;
}

.activity-item p {
  margin: 0;
  color: var(--muted);
}

.activity-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.news-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 248, 242, 0.92)), var(--panel);
}

body.theme-dark .portal-alerts,
body.theme-dark .festival-banner,
body.theme-dark .metro-ticker,
body.theme-dark .broadcast-composer,
body.theme-dark .profile-info-item,
body.theme-dark .profile-photo-card img,
body.theme-dark .news-card {
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .festival-banner {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.22), rgba(216, 166, 59, 0.16)), rgba(25, 25, 28, 0.9);
}

body.theme-dark .metro-ticker,
body.theme-dark .broadcast-composer {
  background: rgba(24, 24, 27, 0.92);
}

body.theme-dark .profile-info-item {
  background: rgba(24, 24, 27, 0.94);
}

body.theme-dark .profile-link:hover {
  color: #ffd66a;
}

body.theme-dark .sidebar-profile-button {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.12), rgba(216, 166, 59, 0.1)), rgba(24, 24, 27, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .sidebar-profile-avatar {
  background:
    linear-gradient(135deg, rgba(181, 31, 59, 0.24), rgba(216, 166, 59, 0.2)),
    rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .announcement-popover {
  background: rgba(24, 24, 27, 0.96);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .personal-progress-summary-card {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.16), rgba(255, 218, 92, 0.08));
}

body.theme-dark .personal-progress-panel {
  background: rgba(24, 24, 27, 0.96);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .personal-progress-track {
  background: rgba(255, 218, 92, 0.12);
  border-color: rgba(255, 218, 92, 0.08);
}

body.theme-dark .profile-menu {
  background: rgba(24, 24, 27, 0.96);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .profile-menu-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

body.theme-dark .profile-menu-item-danger {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.18), rgba(216, 166, 59, 0.12));
  color: #fff;
}

body.theme-dark .announcement-popover-item {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.14), rgba(216, 166, 59, 0.1));
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .profile-photo-card {
  background: linear-gradient(180deg, rgba(32, 32, 36, 0.96), rgba(22, 22, 25, 0.96));
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .profile-summary-card,
body.theme-dark .profile-about-card,
body.theme-dark .profile-activity-card,
body.theme-dark .profile-edit-card,
body.theme-dark .profile-achievements-card,
body.theme-dark .profile-search-panel {
  background: rgba(24, 24, 27, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .profile-search-panel {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.12), rgba(216, 166, 59, 0.08)), rgba(24, 24, 27, 0.94);
}

body.theme-dark .history-search-card,
body.theme-dark .history-item-card,
body.theme-dark .history-search-toolbar,
body.theme-dark .history-expanded-item,
body.theme-dark .history-point-card,
body.theme-dark .history-table-head,
body.theme-dark .history-table-row,
body.theme-dark .history-task-row,
body.theme-dark .history-point-detail-card {
  background: rgba(24, 24, 27, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .history-search-result {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.14), rgba(216, 166, 59, 0.1));
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .history-drawer-card {
  background: linear-gradient(180deg, rgba(34, 34, 40, 0.98), rgba(24, 24, 28, 0.98));
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .history-drawer-card strong,
body.theme-dark .history-drawer-card .history-task-row-title,
body.theme-dark .history-drawer-card .history-point-card strong,
body.theme-dark .history-drawer-card .history-point-detail-card strong,
body.theme-dark .history-drawer-card .history-expanded-item strong {
  color: #ffffff;
}

body.theme-dark .history-drawer-card span,
body.theme-dark .history-drawer-card p,
body.theme-dark .history-drawer-card .history-task-row-meta,
body.theme-dark .history-drawer-card .history-point-detail-meta,
body.theme-dark .history-drawer-card .history-approval-info,
body.theme-dark .history-drawer-card .history-expanded-item span,
body.theme-dark .history-drawer-card .history-point-card p {
  color: var(--muted);
}

body.theme-dark .history-drawer-card .history-expanded-item,
body.theme-dark .history-drawer-card .history-point-card,
body.theme-dark .history-drawer-card .history-point-detail-card,
body.theme-dark .history-drawer-card .history-task-row {
  background: rgba(28, 28, 34, 0.98);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .history-drawer-card .history-task-row-active {
  background: rgba(181, 31, 59, 0.16);
  border-color: rgba(181, 31, 59, 0.28);
}

body.theme-dark .history-drawer-card .history-inline-expansion,
body.theme-dark .history-drawer-card .history-task-inline-detail {
  border-left-color: rgba(181, 31, 59, 0.28);
}

body.theme-dark .history-drawer-card .feedback-history {
  background: rgba(216, 166, 59, 0.16);
  border-color: rgba(216, 166, 59, 0.28);
  color: #ffffff;
}

body.theme-dark .history-table-head {
  color: rgba(255, 255, 255, 0.72);
}

body.theme-dark .history-view-link {
  color: rgba(255, 255, 255, 0.9);
}

body.theme-dark .history-search-result-active {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.22), rgba(216, 166, 59, 0.16));
}

body.theme-dark .compliance-expanded-card {
  background: linear-gradient(180deg, rgba(34, 34, 40, 0.98), rgba(24, 24, 28, 0.98));
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .history-item-meta span {
  background: rgba(255, 255, 255, 0.04);
}

body.theme-dark .profile-stat {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.14), rgba(216, 166, 59, 0.12));
  border-color: rgba(255, 255, 255, 0.06);
}

body.theme-dark .profile-edit-grid label {
  background: rgba(24, 24, 27, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .profile-upload {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .profile-upload input {
  background: rgba(20, 20, 22, 0.96);
}

body.theme-dark .badge-profile {
  background: rgba(216, 166, 59, 0.18);
  color: #ffe7a4;
}

body.theme-dark .achievement-card {
  background: rgba(20, 20, 22, 0.96);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .achievement-card-active {
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.18), rgba(216, 166, 59, 0.12));
}

body.theme-dark .achievement-icon {
  background: rgba(216, 166, 59, 0.18);
  color: #ffe7a4;
}

body.theme-dark .profile-bio-readonly,
body.theme-dark .activity-item {
  background: rgba(20, 20, 22, 0.96);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .activity-item p {
  color: rgba(255, 255, 255, 0.76);
}

body.theme-dark .activity-item::before {
  background: rgba(216, 166, 59, 0.16);
}

@keyframes ticker-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes ghost-cursor-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

.sidebar.panel {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  overflow-y: auto;
  align-self: start;
}

.sidebar .panel-header {
  margin-bottom: 8px;
  padding-left: 0;
  padding-right: 0;
}

.sidebar .section-tag {
  margin-bottom: 4px;
}

.sidebar .panel-header h2,
.sidebar .section-tag {
  margin-left: 0;
}

.home-stack {
  display: grid;
  gap: 22px;
}

.landing-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: stretch;
}

.landing-copy,
.landing-dashboard,
.home-section,
.mosaic-card,
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.landing-copy {
  background:
    radial-gradient(circle at top right, rgba(216, 166, 59, 0.2), transparent 32%),
    linear-gradient(135deg, rgba(181, 31, 59, 0.08), rgba(255, 255, 255, 0.92)),
    var(--panel);
}

.landing-copy h2 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(2.2rem, 4.5vw, 4.6rem);
  line-height: 1.02;
  max-width: 760px;
}

.landing-lead {
  margin: 16px 0 0;
  max-width: 620px;
  font-size: 1.08rem;
  color: var(--muted);
}

.landing-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.mini-proof {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.mini-proof span {
  color: var(--muted);
}

.landing-dashboard {
  display: grid;
  gap: 18px;
  background:
    linear-gradient(160deg, rgba(17, 17, 17, 0.04), rgba(216, 166, 59, 0.1)),
    var(--panel);
}

.landing-dashboard-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.landing-dashboard-top h3 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: 1.4rem;
}

.landing-status-grid,
.home-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.status-card {
  border-radius: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.status-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.status-card strong {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 1.7rem;
  margin-bottom: 8px;
}

.good-card {
  background: linear-gradient(135deg, rgba(31, 122, 77, 0.12), rgba(255, 255, 255, 0.9));
}

.alert-card-soft {
  background: linear-gradient(135deg, rgba(179, 35, 35, 0.1), rgba(255, 255, 255, 0.92));
}

.sequence-preview {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.sequence-ticker {
  position: relative;
  height: 270px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
}

.sequence-track {
  display: grid;
  gap: 10px;
  animation: dar-scroll 28s linear infinite;
}

.sequence-line {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(17, 17, 17, 0.04);
}

.feature-mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.mosaic-card-large {
  grid-column: span 2;
}

.mosaic-card h3,
.detail-card h3 {
  margin: 0 0 10px;
  font-family: "Montserrat", sans-serif;
  font-size: 1.28rem;
}

.mosaic-card p,
.detail-card p,
.landing-dashboard p {
  color: var(--muted);
}

.bento-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.bento-card {
  min-height: 220px;
}

.bento-tall {
  min-height: 460px;
}

.bento-wide {
  grid-column: 1 / -1;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.overview-hub {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  padding: 20px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(245, 239, 231, 0.92));
  border: 1px solid var(--line);
  box-shadow:
    18px 18px 34px rgba(17, 17, 17, 0.08),
    -14px -14px 30px rgba(255, 255, 255, 0.65);
}

body.theme-dark .overview-hub {
  background: linear-gradient(145deg, rgba(38, 38, 38, 0.98), rgba(24, 24, 24, 0.96));
  box-shadow:
    18px 18px 34px rgba(0, 0, 0, 0.4),
    -10px -10px 26px rgba(66, 52, 23, 0.12);
}

.overview-stream,
.overview-metrics-stack {
  display: grid;
  gap: 14px;
}

.hierarchy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.hierarchy-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.hierarchy-card header {
  display: grid;
  gap: 4px;
}

.hierarchy-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.hierarchy-card li strong {
  color: var(--text);
}

.metric-tile {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 4px;
}

.metric-tile span {
  display: block;
  color: var(--muted);
  margin-bottom: 0;
}

.metric-tile strong {
  font-family: "Montserrat", sans-serif;
  font-size: 1.9rem;
}

.compliance-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.compliance-filter-form {
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) minmax(0, 1fr);
  align-items: end;
}

.compliance-date-field,
.compliance-month-field,
.compliance-search-field {
  min-width: 0;
}

.metric-filter-card {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 4px;
}

.metric-filter-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 0;
}

.metric-filter-card strong {
  font-family: "Montserrat", sans-serif;
  font-size: 1.7rem;
}

.metric-filter-card:hover {
  transform: translateY(-1px);
  border-color: var(--maroon);
  box-shadow: 0 10px 24px rgba(181, 31, 59, 0.12);
}

.active-filter {
  border-color: var(--maroon);
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.05), rgba(216, 166, 59, 0.08)), var(--panel-strong);
  box-shadow: inset 0 0 0 1px rgba(181, 31, 59, 0.16);
  transform: translateY(1px);
}

.success-filter strong {
  color: var(--good);
}

.danger-filter strong {
  color: var(--late);
}

body.theme-dark .metric-filter-card {
  border-color: transparent;
  background: #2b2b2b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

body.theme-dark .metric-filter-card:hover {
  border-color: transparent;
  background: #343434;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

body.theme-dark .active-filter {
  background: #3a3429;
  box-shadow: inset 0 0 0 1px rgba(216, 166, 59, 0.18), 0 10px 20px rgba(0, 0, 0, 0.24);
}

body.theme-dark .overview-hub .assignment-card,
body.theme-dark .overview-hub .metric-tile,
body.theme-dark .compliance-metrics-row .metric-filter-card {
  color: var(--text);
}

.pulse-card {
  animation: pulse-glow 1.8s ease-in-out infinite;
}

.live-stream-marquee {
  position: relative;
  height: 360px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
}

.live-stream-track {
  display: grid;
  gap: 12px;
  animation: dar-scroll 24s linear infinite;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  align-content: start;
  margin-bottom: 0;
}

.sidebar-nav button {
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 0.95rem;
}

.nav-item-icon {
  font-size: 1.25rem;
  margin-right: 14px;
  display: inline-block;
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}

body.sidebar-collapsed .nav-item-icon {
  font-size: 1.5rem;
  margin-right: 0;
}

body.sidebar-collapsed .sidebar-nav button span:not(.nav-item-icon) {
  display: none;
}

body.sidebar-collapsed .sidebar-quick-copy,
body.sidebar-collapsed .sidebar-profile-copy,
body.sidebar-collapsed .section-tag,
body.sidebar-collapsed .panel-header h2,
body.sidebar-collapsed .toggle-text {
  display: none;
}

body.sidebar-collapsed .theme-switch-btn {
  padding: 8px 4px !important;
}


.sidebar-bottom-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.sidebar-quick-action {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  box-shadow: 0 8px 20px rgba(17, 17, 17, 0.05);
}

.sidebar-quick-action:hover {
  transform: translateY(-1px);
  border-color: rgba(181, 31, 59, 0.18);
}

.sidebar-quick-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.08), rgba(216, 166, 59, 0.16));
  font-size: 1rem !important;
}

.sidebar-quick-copy {
  text-align: left;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
}

.sidebar-profile-button.sidebar-quick-action {
  grid-template-columns: 36px 1fr;
}

.sidebar-profile-button .sidebar-quick-icon {
  margin: 0;
}

.sidebar-collapse-toggle {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

#sidebarDarStreamPanel {
  overflow: hidden;
}

.sidebar-live-stream {
  gap: 12px;
}

.point-live-card {
  animation: point-slide-in 360ms ease;
}

.point-live-card-new {
  border-color: rgba(181, 31, 59, 0.26);
  box-shadow: 0 10px 22px rgba(181, 31, 59, 0.12);
}

.content-stack {
  display: grid;
  gap: 20px;
}

#darSection {
  width: 100%;
}

.dar-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.86fr);
  gap: 18px;
  align-items: start;
}

.dar-form-panel,
.dar-stream-panel {
  min-width: 0;
}

.dar-stream-panel {
  align-self: start;
}

.overview-analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.overview-analytics-card {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.overview-analytics-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.overview-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  margin-inline: auto;
  background: conic-gradient(var(--maroon) 0 var(--progress), rgba(17, 17, 17, 0.08) var(--progress) 100%);
}

.overview-ring::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--panel-strong);
  box-shadow: inset 0 0 0 1px var(--line);
}

.overview-ring span {
  position: relative;
  z-index: 1;
  font-family: "Montserrat", sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
}

.overview-delta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.trend-up {
  color: var(--good);
}

.trend-down {
  color: var(--late);
}

.trend-flat {
  color: var(--gold);
}

.time-input-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.history-summary-box {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.history-summary-box label {
  min-width: 140px;
}

.history-work-total {
  min-width: 150px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
}

.history-work-total-inline {
  margin: 0 0 14px;
}

.history-search-panel {
  margin-top: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.history-search-box {
  display: grid;
  gap: 14px;
}

.history-search-panel {
  display: grid;
  margin-bottom: 14px;
}

.history-search-toolbar {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 24px rgba(17, 17, 17, 0.05);
}

.history-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.history-type-tabs .compact-button {
  min-height: 38px;
  width: 100%;
  justify-content: center;
  white-space: normal;
  text-align: center;
  line-height: 1.15;
  padding-inline: 10px;
}

@media (max-width: 768px) {
  .history-type-tabs {
    grid-template-columns: 1fr;
  }

  .history-type-tabs .compact-button {
    min-height: 40px;
  }
}

.history-mini-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.history-mini-search label {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-mini-search input {
  min-height: 42px;
  padding: 10px 14px;
  font-size: 1rem;
}

.profile-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.history-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.history-table-shell {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.history-table-head,
.history-table-row {
  display: grid;
  align-items: center;
  gap: 10px;
}

.history-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-sort-trigger {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.history-sort-trigger-active {
  color: var(--maroon);
}

.history-sort-trigger span {
  font-size: 0.75rem;
}

.history-table-body {
  display: grid;
  gap: 10px;
}

.history-table-item {
  display: grid;
  gap: 12px;
}

.history-table-grid-with-employee {
  grid-template-columns: minmax(220px, 1.1fr) minmax(120px, 0.72fr) minmax(110px, 0.68fr) minmax(170px, 0.92fr) minmax(120px, 0.68fr) minmax(92px, auto);
}

.history-table-grid-self {
  grid-template-columns: minmax(120px, 0.78fr) minmax(110px, 0.66fr) minmax(170px, 0.92fr) minmax(120px, 0.68fr) minmax(92px, auto);
}

.history-table-row {
  width: 100%;
  text-align: left;
  appearance: none;
  font: inherit;
  cursor: pointer;
  padding: 14px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: 0 10px 22px rgba(17, 17, 17, 0.05);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.history-row-open {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.history-table-row:hover {
  transform: translateY(-1px);
  border-color: rgba(181, 31, 59, 0.22);
  box-shadow: 0 16px 28px rgba(17, 17, 17, 0.08);
}

.history-table-row-active {
  border-color: rgba(181, 31, 59, 0.34);
  box-shadow: 0 0 0 1px rgba(181, 31, 59, 0.12), 0 18px 30px rgba(17, 17, 17, 0.08);
}

.history-cell {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.history-cell small {
  color: var(--muted);
  font-size: 0.78rem;
}

.history-cell-employee strong {
  display: block;
  font-family: "Montserrat", sans-serif;
  font-size: 0.96rem;
}

.history-row-index {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(181, 31, 59, 0.1);
  color: var(--maroon);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.history-row-date {
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
}

.history-cell-employee small {
  color: var(--muted);
  font-size: 0.8rem;
}

.history-efficiency-cell {
  display: grid;
  gap: 6px;
}

.history-efficiency-cell .efficiency-track {
  height: 8px;
}

.history-efficiency-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
}

.history-action-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  color: var(--maroon);
  font-weight: 800;
}

.history-view-link {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.history-row-chevron {
  font-size: 1.2rem;
  line-height: 1;
}

.history-table-empty {
  min-height: 120px;
  align-items: center;
}

.history-drawer-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.history-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.history-pagination-info {
  color: var(--muted);
  font-size: 0.86rem;
}

.history-pagination-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-pagination-actions .compact-button {
  min-width: 42px;
}

.history-pagination-actions .compact-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.history-drawer-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.history-drawer-card > * {
  min-width: 0;
}

.history-expanded-summary,
.history-detail-status-row,
.history-approval-info,
.history-review-actions,
.history-edit-row,
.feedback-history,
.feedback-wrap {
  grid-column: 1 / -1;
}

.history-drawer-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.history-drawer-card-split {
  align-items: start;
}

.history-task-section {
  display: grid;
  gap: 12px;
}

.history-task-list {
  display: grid;
  gap: 10px;
}

.history-task-item {
  display: grid;
  gap: 8px;
}

.history-inline-expansion {
  padding: 0 0 0 18px;
  border-left: 3px solid rgba(181, 31, 59, 0.16);
}

.history-task-inline-detail {
  padding-left: 14px;
  border-left: 2px solid rgba(181, 31, 59, 0.16);
}

.history-task-row {
  width: 100%;
  text-align: left;
  appearance: none;
  font: inherit;
  cursor: pointer;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.history-task-row-active {
  border-color: rgba(181, 31, 59, 0.28);
  background: rgba(181, 31, 59, 0.08);
}

.history-task-row-title {
  font-weight: 800;
}

.history-task-row-meta,
.history-point-detail-meta {
  color: var(--muted);
  font-size: 0.84rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.history-approval-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-point-detail-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.history-point-detail-card p {
  margin: 0;
}

.profile-search-results .history-search-result strong,
.history-search-results .history-search-result strong,
.history-search-card strong,
.history-item-card strong,
.history-point-card strong {
  font-family: "Montserrat", sans-serif;
}

.profile-search-results .history-search-result span,
.history-search-results .history-search-result span,
.history-search-card span,
.history-item-meta span,
.history-expanded-item span,
.history-point-card p {
  color: var(--muted);
}

.history-search-result {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.06), rgba(216, 166, 59, 0.08));
  cursor: pointer;
}

.history-search-result-active {
  border-color: rgba(181, 31, 59, 0.34);
  box-shadow: 0 0 0 1px rgba(181, 31, 59, 0.12);
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.12), rgba(216, 166, 59, 0.12));
}

.history-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.history-layout.history-layout-open {
  grid-template-columns: 1fr;
}

.history-layout > .panel-inline {
  min-width: 0;
}

.history-layout > #historyDetailPanel {
  overflow: hidden;
  margin-top: -2px;
}

.history-employee-list,
.history-item-list,
.history-detail-stack {
  display: grid;
  gap: 12px;
}

.history-search-card,
.history-item-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  display: grid;
  gap: 12px;
  box-shadow: 0 14px 28px rgba(17, 17, 17, 0.06);
}

.history-search-card header,
.history-item-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.history-employee-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(255, 255, 255, 0.9);
  flex: 0 0 auto;
}

.history-search-card-active {
  border-color: rgba(181, 31, 59, 0.28);
}

.history-item-leading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.history-serial {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(181, 31, 59, 0.1);
  color: var(--maroon);
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
}

.history-item-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.84rem;
}

.history-item-meta span {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.04);
}

.history-efficiency {
  min-width: 0;
}

.history-item-body {
  display: grid;
  gap: 14px;
  padding-top: 6px;
}

.history-performance-box {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.history-performance-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.history-detail-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.history-efficiency-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.history-status-filter {
  display: grid;
  gap: 8px;
  max-width: 220px;
}

.history-status-filter select {
  width: 100%;
}

.history-expanded-card {
  display: grid;
  gap: 14px;
}

.history-expanded-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.history-expanded-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.history-expanded-points {
  display: grid;
  gap: 10px;
}

.history-date-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.history-selected-detail {
  display: grid;
  gap: 12px;
}

.history-point-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.history-point-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.history-edit-row {
  justify-content: flex-end;
}

.increment-box {
  display: grid;
  gap: 14px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  padding: 18px;
  background: var(--panel-strong);
}

.point-feedback-pop {
  animation: point-pulse 420ms ease;
}

.compliance-expanded-row td {
  padding: 0 0 14px;
  background: transparent;
}

.compliance-expanded-card {
  margin-top: 8px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  display: grid;
  gap: 12px;
}

.compliance-row {
  transition: background 180ms ease, transform 180ms ease;
}

.compliance-row:hover {
  background: rgba(181, 31, 59, 0.04);
}

.efficiency-cell {
  display: grid;
  gap: 8px;
  min-width: 140px;
}

.efficiency-cell-expanded {
  min-width: 220px;
}

.efficiency-track {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  overflow: hidden;
}

.efficiency-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.efficiency-low span {
  background: linear-gradient(90deg, #e14b4b, #c62a2a);
}

.efficiency-mid span {
  background: linear-gradient(90deg, #f4b23b, #e2881e);
}

.efficiency-high span {
  background: linear-gradient(90deg, #2fb36b, #1f8b4d);
}

.efficiency-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 0.84rem;
}

.efficiency-meta strong {
  font-family: "Montserrat", sans-serif;
}

.efficiency-meta span,
.efficiency-empty {
  color: var(--muted);
  font-size: 0.82rem;
}

.feedback-input-wrap,
.feedback-history {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(216, 166, 59, 0.45);
  background: rgba(216, 166, 59, 0.22);
  color: #111111;
}

.feedback-history p {
  margin: 6px 0 0;
}

.reminder-button {
  background: transparent;
}

body.theme-dark .feedback-input-wrap,
body.theme-dark .feedback-history {
  background: rgba(216, 166, 59, 0.2);
  border-color: rgba(216, 166, 59, 0.34);
  color: #ffffff;
}

body.theme-dark .action-approve {
  background: rgba(31, 122, 77, 0.22);
  border-color: rgba(109, 214, 155, 0.18);
  color: #9cf0bf;
}

body.theme-dark .action-reject {
  background: rgba(179, 35, 35, 0.26);
  border-color: rgba(255, 157, 157, 0.14);
  color: #ffd3d3;
}

body.theme-dark .action-feedback {
  background: rgba(216, 166, 59, 0.24);
  border-color: rgba(216, 166, 59, 0.34);
  color: #ffffff;
}

.action-approve:hover {
  background: rgba(31, 122, 77, 0.2);
  color: var(--good);
}

.action-reject:hover {
  background: rgba(179, 35, 35, 0.2);
  color: var(--late);
}

.action-feedback:hover {
  background: rgba(216, 166, 59, 0.4);
  color: #111111;
}

.action-click-success {
  animation: action-success-bounce 620ms ease;
}

body.theme-dark .action-approve:hover {
  background: rgba(31, 122, 77, 0.3);
  color: #b8ffd4;
}

body.theme-dark .action-reject:hover {
  background: rgba(179, 35, 35, 0.34);
  color: #ffe3e3;
}

body.theme-dark .action-feedback:hover {
  background: rgba(216, 166, 59, 0.32);
  color: #ffffff;
}

.compliance-expanded-head,
.inline-feedback-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.inline-feedback-row input {
  flex: 1 1 auto;
}

.attachment-inline {
  width: fit-content;
}

.icon-toggle {
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.theme-icon {
  position: absolute;
  font-size: 1.25rem;
  transition: transform 220ms ease, opacity 220ms ease;
}

.site-footer {
  margin-top: 28px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.company-footer {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.footer-brand,
.footer-column {
  display: grid;
  gap: 8px;
}

.footer-column strong,
.footer-brand strong {
  font-family: "Montserrat", sans-serif;
}

.footer-column span,
.footer-column a {
  color: var(--muted);
}

.site-footer p {
  margin: 6px 0 0;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.success-toast {
  background: rgba(17, 17, 17, 0.22);
  z-index: 30;
}

.success-toast-card {
  min-width: 320px;
  text-align: center;
  padding: 28px 24px;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: pop-in 400ms ease;
}

.success-check {
  width: 78px;
  height: 78px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3cc27a, #1f7a4d);
  position: relative;
}

.success-check::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 39px;
  width: 14px;
  height: 6px;
  border-left: 5px solid #fff;
  border-bottom: 5px solid #fff;
  transform: rotate(-45deg);
}

.success-check::after {
  content: "";
  position: absolute;
  left: 34px;
  top: 32px;
  width: 24px;
  height: 12px;
  border-left: 5px solid #fff;
  border-bottom: 5px solid #fff;
  transform: rotate(-45deg);
}

.hidden {
  display: none !important;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes login-fade {
  0% {
    opacity: 0;
    transform: scale(1.03);
  }
  8% {
    opacity: 1;
    transform: scale(1);
  }
  24% {
    opacity: 1;
    transform: scale(1);
  }
  32% {
    opacity: 0;
    transform: scale(1.02);
  }
  100% {
    opacity: 0;
    transform: scale(1.03);
  }
}

@keyframes dar-scroll {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-50%);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 0.75;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.01);
  }
}

@keyframes point-slide-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes point-pulse {
  0% {
    transform: scale(0.98);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes logo-float {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 6px 10px rgba(17, 17, 17, 0.08));
  }
  50% {
    transform: translateY(-2px) scale(1.015);
    filter: drop-shadow(0 10px 18px rgba(17, 17, 17, 0.12));
  }
}

@keyframes logo-sheen {
  0% {
    transform: translateX(-120%) rotate(12deg);
    opacity: 0;
  }
  18% {
    opacity: 0.55;
  }
  38% {
    transform: translateX(320%) rotate(12deg);
    opacity: 0;
  }
  100% {
    transform: translateX(320%) rotate(12deg);
    opacity: 0;
  }
}

@keyframes action-success-bounce {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(17, 17, 17, 0);
  }
  35% {
    transform: scale(0.94);
    box-shadow: 0 0 0 rgba(17, 17, 17, 0);
  }
  60% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(216, 166, 59, 0.12);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(216, 166, 59, 0);
  }
}

@media (max-width: 980px) {
  .hero-grid,
  .page-grid,
  .dashboard-grid,
  .portal-layout,
  .landing-hero,
  .feature-mosaic,
  .bento-grid,
  .overview-grid,
  .overview-hub,
  .compliance-metrics-row,
  .landing-status-grid,
  .home-detail-grid,
  .feature-grid,
  .feature-grid-compact,
  .stats-grid,
  .form-grid,
  .time-input-grid {
    grid-template-columns: 1fr;
  }

  .brandmark,
  .header-actions,
  .panel-header,
  .action-row,
  .assignment-card header,
  .report-card header,
  .download-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .brandbar {
    grid-template-columns: auto 1fr auto;
    justify-items: stretch;
    gap: 14px;
  }

  .brandmark,
  .header-actions {
    grid-column: auto;
  }

  .portal-brandbar {
    padding: 12px 16px;
    grid-template-columns: auto 1fr auto;
  }

  .portal-brandbar .header-actions {
    grid-column: 3;
    justify-self: end;
  }

  .portal-header-actions {
    flex-direction: row;
    align-items: center;
  }

  .portal-brandbar .brandmark {
    grid-column: 1;
  }

  .portal-brandmark {
    width: 108px;
    min-height: 108px;
    padding: 7px;
    flex-direction: column;
    align-items: center;
  }

  .portal-login-greeting {
    width: 100%;
  }

  .portal-login-greeting h1 {
    font-size: clamp(1.4rem, 3.6vw, 2.7rem);
  }

  .portal-login-greeting p:last-child {
    font-size: clamp(0.62rem, 0.95vw, 0.82rem);
    letter-spacing: 0.26em;
  }

  .gate-layout {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .foundation-pillar-grid {
    grid-template-columns: 1fr;
  }

  .foundation-pillar-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    font-size: 0.95rem;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .company-footer {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1220px);
  }

  .brandmark-logo {
    width: auto;
    justify-content: center;
  }

  .portal-ghost-canvas {
    min-height: 88px;
    padding-inline: 10px;
  }

  .ghost-primary {
    font-size: clamp(1.38rem, 4.2vw, 2.35rem);
  }

  .ghost-secondary {
    font-size: clamp(0.68rem, 1.15vw, 0.92rem);
  }

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

  .profile-info-grid {
    grid-template-columns: 1fr;
  }

  .profile-edit-grid {
    grid-template-columns: 1fr;
  }

  .profile-summary-head,
  .profile-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-stats {
    width: 100%;
    grid-template-columns: 1fr;
  }

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

  .profile-search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-search-form .button {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .shell {
    width: min(100% - 16px, 1220px);
    padding: 18px 0 28px;
  }

  .portal-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .brandbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    justify-items: stretch;
    gap: 10px;
  }

  .portal-brandbar {
    gap: 10px;
    grid-template-columns: auto 1fr auto;
    padding: 10px 16px;
    min-height: 56px;
  }

  .portal-header-actions {
    justify-self: end;
    flex-direction: row;
    align-items: center;
  }

  .brandmark {
    grid-column: auto;
  }

  .header-actions {
    grid-column: auto;
    flex: 0 1 auto;
    width: auto;
    align-items: center;
    gap: 10px;
    justify-self: center;
  }

  .nav-links {
    width: auto;
    gap: 8px;
  }

  .brandmark-logo {
    width: auto;
    min-width: fit-content;
  }

  .brandmark-logo img {
    width: 76px;
  }

  .portal-brandmark {
    gap: 0;
    padding: 7px;
    flex-direction: column;
    align-items: center;
  }

  .portal-login-greeting {
    gap: 2px;
  }

  .portal-login-greeting h1 {
    font-size: clamp(1.18rem, 4vw, 2.1rem);
  }

  .portal-login-greeting p:last-child {
    font-size: 0.64rem;
    letter-spacing: 0.18em;
  }

  .portal-ghost-canvas {
    display: none;
  }

  .gate-copy-panel,
  .gate-auth-panel {
    padding: 20px;
  }

  .gate-copy-panel h2 {
    font-size: 1.52rem;
  }

  .foundation-pillar-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    font-size: 0.92rem;
  }

  .gate-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .announcement-popover {
    right: 0;
    width: min(92vw, 380px);
  }

  .profile-menu {
    right: 0;
    width: min(92vw, 220px);
  }

  .portal-alerts {
    gap: 12px;
  }

  .festival-banner,
  .metro-ticker,
  .broadcast-composer {
    border-radius: 20px;
  }

  .profile-grid {
    gap: 14px;
  }

  .profile-info-grid {
    grid-template-columns: 1fr;
  }

  .profile-edit-grid {
    grid-template-columns: 1fr;
  }

  .profile-actions {
    align-items: flex-start;
  }

  .profile-summary-head,
  .profile-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-stats {
    width: 100%;
    grid-template-columns: 1fr;
  }

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

  .profile-search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-search-form .button {
    width: 100%;
  }

  .dar-workspace,
  .overview-analytics-grid {
    grid-template-columns: 1fr;
  }

  .sidebar.panel {
    padding: 18px 16px;
  }

  .sidebar .panel-header {
    margin-bottom: 6px;
  }

  .sidebar .identity-strip {
    text-align: center;
    justify-items: center;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .sidebar-nav button {
    flex: 0 0 auto;
    width: auto;
    min-width: 180px;
    white-space: nowrap;
  }

  .sidebar-bottom-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-profile-button.sidebar-quick-action {
    grid-column: 1 / -1;
  }

  .compliance-metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
  }

  .metric-filter-card {
    min-height: 88px;
    padding: 12px;
  }

  .metric-filter-card span {
    font-size: 0.76rem;
  }

  .metric-filter-card strong {
    font-size: 1.2rem;
  }

  #complianceSearchForm,
  #complianceSearchForm label,
  #complianceDateFilter,
  #complianceSearchInput {
    width: 100%;
  }

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

  .panel-header {
    gap: 10px;
  }

  #complianceSection .panel-header {
    align-items: stretch;
  }

  #complianceExportDropdown,
  #exportMenuButton {
    width: 100%;
  }

  #complianceExportDropdown {
    display: flex;
  }

  .export-menu {
    left: 0;
    right: 0;
    width: auto;
    max-height: 68vh;
  }

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

  table {
    min-width: 760px;
  }

  .compliance-expanded-head,
  .inline-feedback-row {
    flex-direction: column;
    align-items: stretch;
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-drawer-card {
    grid-template-columns: 1fr;
  }

  .history-expanded-summary,
  .history-detail-status-row,
  .history-approval-info,
  .history-review-actions,
  .history-edit-row,
  .feedback-history,
  .feedback-wrap {
    grid-column: auto;
  }

  .history-expanded-summary {
    grid-template-columns: 1fr;
  }

  .profile-search-results,
  .history-search-results {
    grid-template-columns: 1fr;
  }
}

/* ====================================================
   PORTAL LOGGED-IN: show dashboard, hide gate
   ==================================================== */
body.portal-logged-in #portalGate { display: none; }
body.portal-logged-in .login-slideshow { display: none; }
#portalDashboard.hidden { display: none !important; }
#portalGate.hidden { display: none !important; }

/* ====================================================
   TOPBAR GHOST TEXT (within .portal-topbar-ghost)
   ==================================================== */
.portal-topbar-ghost .ghost-stack {
  display: grid;
  gap: 2px;
}
.portal-topbar-ghost .ghost-line {
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-topbar-ghost .ghost-primary {
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  color: rgba(101,14,29,0.92);
  letter-spacing: -0.02em;
  line-height: 1;
}
body.theme-dark .portal-topbar-ghost .ghost-primary {
  color: rgba(255,220,200,0.92);
}
.ghost-greeting-prefix,
.ghost-greeting-suffix {
  color: inherit;
}
.ghost-greeting-name {
  color: var(--maroon);
  font-weight: 900;
}
body.theme-dark .ghost-greeting-name {
  color: #e6a1ae;
}
.portal-topbar-ghost .ghost-secondary {
  font-size: clamp(0.7rem, 0.9vw, 0.85rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  font-family: "Montserrat", sans-serif;
  line-height: 1.2;
}
.ghost-cursor {
  display: inline-block;
  animation: blink 1s step-start infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ====================================================
   CREDENTIAL TABLE — Excel-style
   ==================================================== */
.cred-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.cred-tab {
  font-size: 0.82rem;
  padding: 6px 14px;
}
.cred-table-wrap,
.admin-user-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.credential-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.credential-table thead tr {
  background: linear-gradient(135deg, rgba(181,31,59,0.07), rgba(216,166,59,0.10));
}
.credential-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  font-family: "Montserrat", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.credential-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.cred-row-alt td {
  background: rgba(17,17,17,0.025);
}
body.theme-dark .cred-row-alt td {
  background: rgba(255,255,255,0.025);
}
.credential-table tbody tr:hover td {
  background: var(--gold-soft);
}
.cred-num {
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
  width: 32px;
}
.cred-id {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--maroon);
}
body.theme-dark .cred-id {
  color: #f0a0a0;
}
.cred-pass {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Level badges in credential table */
.cred-level-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.cred-level-admin { background: rgba(181,31,59,0.12); color: var(--maroon-dark); }
.cred-level-1 { background: rgba(31,122,77,0.12); color: var(--good); }
.cred-level-2 { background: rgba(216,166,59,0.18); color: #7a5800; }
.cred-level-3 { background: rgba(17,17,17,0.08); color: var(--muted); }
body.theme-dark .cred-level-2 { color: #f0d080; }
body.theme-dark .cred-level-3 { color: var(--muted); }

/* ====================================================
   BULK DELETE TOOLBAR
   ==================================================== */
.bulk-delete-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(181,31,59,0.04), rgba(216,166,59,0.06));
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 12px;
}
.bulk-select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
#bulkDeleteButton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ====================================================
   HIERARCHY TREE — Admin Overview
   ==================================================== */
.org-hierarchy-tree {
  display: grid;
  gap: 16px;
}
.hierarchy-level-group {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.hierarchy-level-header {
  padding: 10px 16px;
  font-weight: 800;
  font-family: "Montserrat", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(181,31,59,0.08), rgba(216,166,59,0.12));
  color: var(--maroon-dark);
  border-bottom: 1px solid var(--line);
}
body.theme-dark .hierarchy-level-header {
  color: #f0a0a0;
}
.hierarchy-level-1-card {
  padding: 14px 16px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
}
.hierarchy-level-1-card:last-child { border-bottom: none; }
.hierarchy-l1-name {
  font-weight: 700;
  font-size: 0.92rem;
  display: block;
  margin-bottom: 2px;
}
.hierarchy-l1-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
.hierarchy-l2-list {
  display: grid;
  gap: 6px;
  padding-left: 16px;
  border-left: 2px solid var(--gold);
  margin-left: 4px;
}
.hierarchy-l2-card {
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(216,166,59,0.07);
  border: 1px solid rgba(216,166,59,0.18);
}
.hierarchy-l2-name {
  font-weight: 700;
  font-size: 0.85rem;
  display: block;
}
.hierarchy-l2-meta {
  font-size: 0.76rem;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}
.hierarchy-l3-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  padding-left: 12px;
  border-left: 2px solid rgba(181,31,59,0.25);
}
.hierarchy-l3-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(181,31,59,0.08);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--maroon-dark);
  border: 1px solid rgba(181,31,59,0.15);
}
body.theme-dark .hierarchy-l3-chip {
  background: rgba(181,31,59,0.18);
  color: #ffc0c0;
}

/* ====================================================
   DARK THEME POLISH
   ==================================================== */
body.theme-dark {
  --bg: #141416;
  --bg-soft: #1a1a1e;
  --panel: rgba(40,40,44,0.97);
  --panel-strong: #30303a;
  --line: rgba(255,255,255,0.09);
  --text: #f0ede8;
  --muted: #b8b2aa;
  --gold-soft: rgba(216,166,59,0.15);
  --shadow: 0 22px 55px rgba(0,0,0,0.45);
}

body.theme-dark .assignment-card,
body.theme-dark .report-card {
  background: linear-gradient(135deg, rgba(48,48,58,0.98), rgba(36,36,44,0.96));
  border-color: rgba(255,255,255,0.07);
}

body.theme-dark .stat-card {
  background: linear-gradient(135deg, rgba(42,42,52,0.98), rgba(34,34,42,0.96));
  border-color: rgba(255,255,255,0.07);
}

body.theme-dark .stat-card span {
  color: var(--muted);
}

body.theme-dark .stat-card strong {
  color: #ffffff;
}

body.theme-dark .hero-card,
body.theme-dark .panel {
  background: rgba(38,38,44,0.97);
  border-color: rgba(255,255,255,0.06);
}

body.theme-dark .metric-tile {
  background: rgba(40,40,50,0.98);
  border-color: rgba(255,255,255,0.07);
}

body.theme-dark .overview-analytics-card {
  background: rgba(40,40,50,0.98);
  border-color: rgba(255,255,255,0.07);
}

body.theme-dark .feature-tile {
  background: rgba(38,38,46,0.98);
  border-color: rgba(255,255,255,0.07);
}

/* Inputs */
body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select {
  background: rgba(24,24,28,0.98);
  border-color: rgba(255,255,255,0.09);
  color: var(--text);
}
body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
  color: rgba(180,175,168,0.55);
}

/* Status pills */
body.theme-dark .status-pill {
  background: rgba(216,166,59,0.22);
  color: #f0d070;
}
body.theme-dark .badge {
  background: rgba(216,166,59,0.2);
  color: #f0d070;
}
body.theme-dark .history-status.status-pending {
  background: rgba(216,166,59,0.22);
  color: #ffd66a;
}
body.theme-dark .history-status.status-approved {
  background: rgba(31,122,77,0.26);
  color: #a0f0c0;
}
body.theme-dark .history-status.status-declined {
  background: rgba(179,35,35,0.30);
  color: #ffd0d0;
}

/* Metric filter cards */
body.theme-dark .metric-filter-card {
  background: rgba(40,40,50,0.96);
  border-color: rgba(255,255,255,0.07);
  color: var(--text);
}
body.theme-dark .metric-filter-card:hover {
  background: rgba(52,52,64,0.98);
  border-color: rgba(216,166,59,0.2);
}
body.theme-dark .active-filter {
  background: linear-gradient(135deg, rgba(181,31,59,0.2), rgba(216,166,59,0.12));
  border-color: rgba(181,31,59,0.3);
  box-shadow: inset 0 0 0 1px rgba(181,31,59,0.2);
}

/* Compliance table */
body.theme-dark .compliance-table-row {
  background: rgba(36,36,44,0.96);
  border-color: rgba(255,255,255,0.06);
}
body.theme-dark th {
  color: rgba(180,175,168,0.8);
  border-color: rgba(255,255,255,0.07);
}
body.theme-dark td {
  border-color: rgba(255,255,255,0.05);
}
body.theme-dark tr:hover td {
  background: rgba(255,255,255,0.03);
}

/* Compact buttons */
body.theme-dark .compact-button {
  background: rgba(40,40,50,0.96);
  border-color: rgba(255,255,255,0.09);
  color: var(--text);
}
body.theme-dark .compact-button:hover {
  background: rgba(216,166,59,0.18);
  border-color: rgba(216,166,59,0.3);
  color: #f0d070;
}
body.theme-dark .action-approve {
  background: rgba(31,122,77,0.18);
  border-color: rgba(31,122,77,0.28);
  color: #9cf0bf;
}
body.theme-dark .action-reject {
  background: rgba(179,35,35,0.18);
  border-color: rgba(179,35,35,0.28);
  color: #ffd0d0;
}

/* Gate card dark */
body.theme-dark .gate-card {
  background: linear-gradient(180deg, rgba(36,36,44,0.99), rgba(28,28,36,0.98));
  border-color: rgba(255,255,255,0.07);
}

/* Overview hub dark */
body.theme-dark .overview-hub {
  background: linear-gradient(145deg, rgba(40,40,48,0.98), rgba(28,28,36,0.96));
  border-color: rgba(255,255,255,0.07);
}

/* Sidebar dark */
body.theme-dark .sidebar.panel {
  background: rgba(26,26,32,0.98);
  border-color: rgba(255,255,255,0.07);
}
body.theme-dark .sidebar-logo-block {
  border-color: rgba(255,255,255,0.08);
}
body.theme-dark .sidebar-nav button:hover {
  background: rgba(216,166,59,0.12);
}
body.theme-dark .sidebar-quick-action {
  background: rgba(32,32,40,0.98);
  border-color: rgba(255,255,255,0.07);
}
body.theme-dark .sidebar-quick-action:hover {
  background: rgba(216,166,59,0.1);
}

/* Portal topbar dark */
body.theme-dark .portal-topbar {
  background: linear-gradient(135deg, rgba(22,22,28,0.99), rgba(18,18,24,0.98));
}

/* Credential table dark */
body.theme-dark .credential-table thead tr {
  background: linear-gradient(135deg, rgba(181,31,59,0.1), rgba(216,166,59,0.08));
}
body.theme-dark .credential-table th {
  color: rgba(180,175,168,0.7);
  border-color: rgba(255,255,255,0.07);
}
body.theme-dark .credential-table td {
  border-color: rgba(255,255,255,0.05);
}
body.theme-dark .cred-table-wrap,
body.theme-dark .admin-user-table-wrap {
  border-color: rgba(255,255,255,0.08);
}
body.theme-dark .cred-level-admin { background: rgba(181,31,59,0.2); color: #ffa0a0; }
body.theme-dark .cred-level-1 { background: rgba(31,122,77,0.2); color: #a0f0c0; }
body.theme-dark .cred-level-2 { color: #f0d080; }
body.theme-dark .bulk-delete-toolbar {
  background: rgba(181,31,59,0.07);
  border-color: rgba(255,255,255,0.08);
}

/* ====================================================
   PORTAL OVERRIDES - larger icons, stronger spacing, card history
   ==================================================== */
.portal-topbar {
  min-height: 92px;
  padding: 16px 24px;
  overflow: visible;
  background:
    radial-gradient(circle at 18% 50%, rgba(181, 31, 59, 0.08), transparent 28%),
    radial-gradient(circle at 82% 38%, rgba(216, 166, 59, 0.16), transparent 22%),
    linear-gradient(135deg, rgba(255,255,255,0.92), rgba(252,246,240,0.96));
}

body.theme-dark .portal-topbar {
  background:
    radial-gradient(circle at 18% 50%, rgba(181, 31, 59, 0.18), transparent 28%),
    radial-gradient(circle at 82% 38%, rgba(216, 166, 59, 0.12), transparent 22%),
    linear-gradient(135deg, rgba(22,22,28,0.99), rgba(18,18,24,0.98));
}

.portal-topbar-ghost {
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 60px;
}

.portal-topbar-ghost .ghost-stack {
  width: 100%;
  align-items: flex-start;
  justify-items: flex-start;
  gap: 4px;
}

.portal-topbar-ghost .ghost-line {
  justify-content: flex-start;
}

.portal-topbar-ghost .ghost-primary {
  font-size: clamp(1.6rem, 2.6vw, 3.5rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.portal-topbar-ghost .ghost-secondary {
  font-size: clamp(0.84rem, 1.05vw, 1.05rem);
  letter-spacing: 0.22em;
}

.portal-topbar-actions {
  align-self: center;
  z-index: 60;
  gap: 14px;
}

.portal-notification-toggle {
  width: 52px;
  height: 52px;
  box-shadow: 0 12px 24px rgba(17, 17, 17, 0.14);
}

.portal-notification-toggle::before {
  font-size: 1.35rem;
}

.portal-notification-toggle.has-notifications {
  animation: bell-vibrate 0.35s linear infinite;
}

@keyframes bell-vibrate {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  8% { transform: translate(-5px, 4px) rotate(-22deg); }
  16% { transform: translate(5px, -4px) rotate(22deg); }
  24% { transform: translate(-5px, 2px) rotate(-18deg); }
  32% { transform: translate(5px, -2px) rotate(18deg); }
  40% { transform: translate(-4px, 4px) rotate(-16deg); }
  48% { transform: translate(4px, -4px) rotate(16deg); }
  56% { transform: translate(-3px, 2px) rotate(-12deg); }
  64% { transform: translate(3px, -2px) rotate(12deg); }
  72% { transform: translate(-2px, 1px) rotate(-8deg); }
  80% { transform: translate(2px, -1px) rotate(8deg); }
}

.announcement-popover {
  z-index: 90;
  right: 0;
}

.sidebar-logo-img {
  display: none;
}

.sidebar-logo-block {
  justify-content: flex-end;
  padding: 12px 14px;
}

.sidebar-collapse-toggle {
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
}

.sidebar-nav {
  padding-top: 12px;
}

.sidebar-nav button {
  font-size: 0.96rem;
  padding: 12px 14px;
}

.nav-item-icon {
  width: 28px;
  min-width: 28px;
  font-size: 1.05rem;
  margin-right: 12px;
}

body.sidebar-collapsed .nav-item-icon {
  font-size: 1.35rem;
}

.sidebar-bottom-actions {
  margin-top: 18px;
  padding: 18px 12px 16px;
  gap: 10px;
  border-top: 2px solid rgba(17, 17, 17, 0.08);
}

body.theme-dark .sidebar-bottom-actions {
  border-top-color: rgba(255,255,255,0.08);
}

.sidebar-quick-action {
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
}

.sidebar-quick-icon {
  width: 32px;
  height: 32px;
  font-size: 1.05rem;
}

.sidebar-profile-button.sidebar-quick-action {
  grid-template-columns: 36px 1fr;
}

.sidebar-profile-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

body.sidebar-collapsed .sidebar-quick-action {
  padding-inline: 8px;
}

.history-summary-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(181, 31, 59, 0.06), rgba(216, 166, 59, 0.08)), var(--panel-strong);
}

.history-summary-strip-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-table-shell,
.history-table-body,
.history-item-list,
.history-detail-stack {
  display: grid;
  gap: 14px;
}

.history-table-head {
  display: none;
}

.history-item-card,
.history-search-card {
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: 0 14px 30px rgba(17,17,17,0.08);
}

.history-item-head,
.history-search-card header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.history-item-leading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.history-item-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-item-copy strong {
  font-family: "Montserrat", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.history-item-copy span,
.history-item-summary {
  color: var(--muted);
  line-height: 1.45;
}

.history-serial {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(181,31,59,0.1);
  color: var(--maroon);
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  flex: 0 0 auto;
}

.history-item-body {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.history-inline-toggle {
  align-self: start;
  justify-self: start;
}

.history-inline-expansion {
  margin-top: 14px;
}

.history-drawer-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(248, 245, 240, 0.94);
  border: 1px solid rgba(17,17,17,0.08);
}

.history-expanded-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.history-expanded-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.76);
}

.history-task-section {
  display: grid;
  gap: 12px;
}

.history-task-list {
  display: grid;
  gap: 10px;
}

.history-task-row {
  width: 100%;
  text-align: left;
}

.history-layout > #historyDetailPanel {
  display: none !important;
}

.history-layout {
  grid-template-columns: 1fr;
}

.history-work-total-inline {
  margin-bottom: 6px;
}

/* ====================================================
   FINAL PORTAL POLISH OVERRIDES
   ==================================================== */
.portal-topbar {
  min-height: 104px;
  padding: 18px 26px;
  border-radius: 0 0 0 26px;
}

.portal-topbar-ghost {
  min-height: 72px;
}

.portal-topbar-ghost .ghost-primary {
  font-size: clamp(1.8rem, 3vw, 4rem);
}

.portal-topbar-ghost .ghost-secondary {
  font-size: clamp(0.9rem, 1.1vw, 1.05rem);
}

.portal-notification-toggle {
  width: 56px;
  height: 56px;
}

.portal-notification-toggle::before {
  font-size: 1.5rem;
}

.sidebar-logo-block {
  justify-content: center;
  padding: 18px 16px 16px;
  min-height: 124px;
}

.sidebar-logo-img {
  display: block;
  width: min(100%, 170px);
  max-height: 84px;
  height: auto;
  object-fit: contain;
}

body.sidebar-collapsed .sidebar-logo-img {
  width: 38px;
  max-height: 38px;
}

.sidebar-nav {
  padding-top: 14px;
}

.sidebar-nav button {
  font-size: 1rem;
  padding: 13px 16px;
}

.nav-item-icon {
  width: 32px;
  min-width: 32px;
  font-size: 1.25rem;
  margin-right: 14px;
}

body.sidebar-collapsed .nav-item-icon {
  font-size: 1.45rem;
}

.sidebar-bottom-actions {
  margin-top: 22px;
  padding: 20px 14px 18px;
  gap: 12px;
}

.sidebar-quick-action {
  grid-template-columns: 40px 1fr;
  padding: 12px 14px;
}

.sidebar-quick-icon {
  width: 36px;
  height: 36px;
  font-size: 1.15rem;
}

.portal-layout > .sidebar {
  top: 86px;
  max-height: calc(100vh - 100px);
}

.portal-layout {
  padding-top: 12px;
  gap: 18px;
}

.increment-box {
  position: relative;
  overflow: hidden;
}

.increment-box::after {
  content: "✎";
  position: absolute;
  right: 16px;
  bottom: 14px;
  font-size: 1rem;
  opacity: 0;
  color: var(--maroon);
  transform: translateY(8px) rotate(-16deg);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.increment-box::before {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 12px;
  width: 42px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(181,31,59,0.5), transparent);
  opacity: 0;
  transform: scaleX(0.85);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.increment-box.is-writing::after,
.increment-box.is-writing::before {
  opacity: 1;
}

.increment-box.is-writing::after {
  animation: pen-write 1.2s ease-in-out infinite;
}

.increment-box.is-writing::before {
  animation: pen-trail 1.2s ease-in-out infinite;
}

.key-press-response {
  animation: key-press-pop 180ms ease;
  box-shadow: 0 0 0 2px rgba(181,31,59,0.08), 0 10px 20px rgba(17,17,17,0.08);
}

input.key-press-response,
textarea.key-press-response,
select.key-press-response {
  border-color: rgba(181,31,59,0.34) !important;
}

button.key-press-response {
  transform: translateY(-1px) scale(0.99);
}

@keyframes key-press-pop {
  0% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
  100% { transform: translateY(0); }
}

@keyframes pen-write {
  0%, 100% { transform: translateY(8px) rotate(-16deg); }
  50% { transform: translateY(3px) rotate(-6deg); }
}

@keyframes pen-trail {
  0%, 100% { transform: scaleX(0.85); opacity: 0.55; }
  50% { transform: scaleX(1); opacity: 0.95; }
}

@media (min-width: 901px) {
  .portal-topbar {
    margin-left: 236px;
    width: calc(100% - 236px);
  }

  body.sidebar-collapsed .portal-topbar {
    margin-left: 88px;
    width: calc(100% - 88px);
  }
}

@media (max-width: 900px) {
  .portal-topbar {
    margin-left: 0;
    width: 100%;
    border-radius: 0;
  }
}

/* ====================================================
   SCREENSHOT MATCH OVERRIDES
   ==================================================== */
body[data-page="portal"] .shell {
  width: 100%;
  max-width: none;
  padding: 0;
}

.portal-outer {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100vh;
  background: #f8f7f4;
}

.portal-outer > .portal-topbar,
.portal-outer > .portal-alerts-full {
  grid-column: 2;
}

.portal-outer > .portal-topbar {
  grid-row: 1;
  margin: 0;
  width: auto;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  min-height: 76px;
  padding: 12px 18px 12px 22px;
  background: #fff;
  box-shadow: none;
}

.portal-outer > .portal-alerts-full {
  grid-row: 2;
  padding: 0;
}

.portal-outer > .portal-layout {
  display: contents;
}

.portal-layout > .sidebar {
  grid-column: 1;
  grid-row: 1 / span 3;
  position: sticky;
  top: 0;
  max-height: 100vh;
  height: 100vh;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  overflow-y: auto;
}

.portal-layout > .content-stack {
  grid-column: 2;
  grid-row: 3;
  padding: 20px 18px 28px 18px;
}

.portal-topbar-ghost {
  min-height: 52px;
  padding-inline: 10px 0;
}

.portal-topbar-ghost .ghost-primary {
  font-size: clamp(1.35rem, 1.8vw, 1.95rem);
  color: var(--maroon);
}

.portal-topbar-ghost .ghost-secondary {
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: #8f8176;
}

.portal-topbar-actions {
  gap: 10px;
}

.portal-notification-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid #d7d2cb;
  background: #fff;
  box-shadow: none;
}

.portal-notification-toggle::before {
  font-size: 1.1rem;
  color: #7e7e7e;
}

.notification-badge {
  top: -4px;
  right: -4px;
}

.sidebar-logo-block {
  min-height: 124px;
  padding: 18px 12px 12px;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo-img {
  width: min(150px, 100%);
  max-height: 92px;
}

body.sidebar-collapsed .sidebar-logo-img {
  width: 44px;
  max-height: 44px;
}

.identity-strip {
  margin: 14px 12px 8px;
  border-radius: 14px;
  padding: 12px 14px;
  background: #f6eef0;
  color: #8c1730;
}

.sidebar-nav {
  padding: 6px 10px 0;
  gap: 8px;
}

.sidebar-nav button {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.92rem;
  color: #4f4f4f;
}

.sidebar-nav button.active-section {
  background: var(--maroon);
  color: #fff;
}

.nav-item-icon {
  width: 28px;
  min-width: 28px;
  font-size: 1.1rem;
  margin-right: 12px;
}

.sidebar-bottom-actions {
  margin-top: auto;
  padding: 18px 12px 14px;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.theme-switch-wrapper {
  background: #f4f1ed;
  border-radius: 999px;
  padding: 4px;
}

.theme-switch-btn {
  border-radius: 999px;
  min-height: 34px;
}

.sidebar-quick-action {
  border-radius: 12px;
  background: #fff;
}

.sidebar-quick-icon {
  background: #f7ecef;
}

.sidebar-signout-icon {
  background: #e0212f;
  color: #fff;
  border-radius: 999px;
}

.sidebar-profile-button {
  background: #fff;
}

.portal-layout > .sidebar,
.portal-layout > .sidebar.panel {
  padding: 0;
}

body.sidebar-collapsed .portal-outer {
  grid-template-columns: 76px minmax(0, 1fr);
}

body.sidebar-collapsed .portal-outer > .portal-topbar {
  border-left-width: 1px;
}

@media (max-width: 900px) {
  .portal-outer {
    grid-template-columns: 1fr;
  }

  .portal-outer > .portal-topbar,
  .portal-outer > .portal-alerts-full,
  .portal-layout > .content-stack,
  .portal-layout > .sidebar {
    grid-column: 1;
    grid-row: auto;
  }

  .portal-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .portal-layout > .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .portal-outer > .portal-topbar {
    border-left: 0;
  }
}

/* ----------------------------------------------------
   FINAL NO-GAP + COLLAPSED SIDEBAR FIXES
   ---------------------------------------------------- */
.portal-outer {
  gap: 0 !important;
}

.portal-outer > .portal-topbar {
  margin: 0 !important;
  width: auto !important;
  border-left: 0 !important;
}

.portal-outer > .portal-alerts-full {
  margin: 0 !important;
}

.portal-layout {
  gap: 0 !important;
  padding: 0 !important;
}

.portal-layout > .content-stack {
  padding: 0 !important;
  margin: 0 !important;
}

.portal-layout > .content-stack > .panel {
  margin: 0 !important;
  border-radius: 0 !important;
}

.portal-layout > .sidebar,
.portal-layout > .sidebar.panel {
  margin: 0 !important;
  border-right: 1px solid var(--line);
}

.sidebar-quick-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

body.sidebar-collapsed .portal-outer {
  grid-template-columns: 76px minmax(0, 1fr) !important;
}

body.sidebar-collapsed .portal-layout > .sidebar {
  width: 76px;
}

body.sidebar-collapsed .sidebar-logo-block {
  min-height: 76px;
  padding: 10px 6px 8px;
}

body.sidebar-collapsed .sidebar-logo-img {
  width: 22px;
  max-height: 22px;
}

body.sidebar-collapsed .sidebar-collapse-toggle {
  width: 28px;
  height: 28px;
  font-size: 1rem;
}

body.sidebar-collapsed .sidebar-bottom-actions {
  padding: 14px 8px 12px;
}

body.sidebar-collapsed .sidebar-quick-action {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 10px 6px;
}

body.sidebar-collapsed .sidebar-quick-icon {
  width: 28px;
  height: 28px;
}

body.sidebar-collapsed .sidebar-signout-icon svg {
  width: 15px;
  height: 15px;
}

body.sidebar-collapsed .portal-topbar {
  margin-left: 0 !important;
  width: auto !important;
  border-left: 0 !important;
}

body.sidebar-collapsed .portal-outer > .portal-topbar,
body.sidebar-collapsed .portal-outer > .portal-alerts-full,
body.sidebar-collapsed .portal-layout > .content-stack {
  margin-left: 0 !important;
}

.portal-login-logo-wrap-inline {
  position: absolute;
  top: 16px;
  right: 18px;
  left: auto;
  width: auto;
  margin: 0;
  z-index: 2;
}

.gate-auth-panel {
  position: relative;
  padding-top: 64px;
}

.portal-login-logo-wrap-inline .portal-login-logo {
  width: 88px;
  max-width: 88px;
  height: auto;
}

body.theme-dark .portal-outer {
  background: #1d1d21;
}

body.theme-dark .portal-outer > .portal-topbar {
  background: #242428;
  border-left-color: #34343a;
  border-bottom-color: #34343a;
}

body.theme-dark .portal-topbar-ghost .ghost-primary {
  color: #f0d9da;
}

body.theme-dark .portal-topbar-ghost .ghost-secondary {
  color: rgba(255,255,255,0.62);
}

body.theme-dark .portal-layout > .sidebar {
  background: #232328;
  border-right-color: #34343a;
}

body.theme-dark .portal-layout > .content-stack > .panel {
  border-radius: 0;
}

body.theme-dark .sidebar-logo-block,
body.theme-dark .sidebar-bottom-actions {
  border-color: #34343a;
  background: #232328;
}

body.theme-dark .identity-strip {
  background: linear-gradient(135deg, rgba(181,31,59,0.14), rgba(216,166,59,0.08));
  color: #f0d9da;
}

body.theme-dark .sidebar-nav button {
  color: rgba(255,255,255,0.7);
}

body.theme-dark .sidebar-nav button.active-section {
  background: var(--maroon);
  color: #fff;
}

body.theme-dark .sidebar-quick-action {
  background: #2a2a30;
  border-color: #3a3a42;
}

body.theme-dark .sidebar-quick-icon {
  background: rgba(255,255,255,0.06);
  color: #f3d6d6;
}

body.theme-dark .sidebar-signout-icon {
  background: #e0212f;
  color: #fff;
}

body.theme-dark .portal-layout > .content-stack > .panel {
  background: #2b2b31;
  border-color: #3b3b43;
  color: rgba(255,255,255,0.92);
}

body.theme-dark .portal-layout > .content-stack > .panel .helper-text,
body.theme-dark .portal-layout > .content-stack > .panel p,
body.theme-dark .portal-layout > .content-stack > .panel label {
  color: rgba(255,255,255,0.76);
}

body.theme-dark .portal-layout > .content-stack > .panel input,
body.theme-dark .portal-layout > .content-stack > .panel select,
body.theme-dark .portal-layout > .content-stack > .panel textarea {
  background: #1c1c20;
  border-color: #3b3b43;
  color: rgba(255,255,255,0.92);
}

body.theme-dark .portal-layout > .content-stack > .panel .section-tag {
  color: rgba(255,255,255,0.58);
}

body.theme-dark .portal-layout > .content-stack > .panel .button-secondary,
body.theme-dark .portal-layout > .content-stack > .panel .compact-button {
  background: #34343a;
  border-color: #474750;
  color: rgba(255,255,255,0.92);
}

body.theme-dark .portal-layout > .content-stack > .panel .button,
body.theme-dark .portal-layout > .content-stack > .panel .action-approve,
body.theme-dark .portal-layout > .content-stack > .panel .action-reject,
body.theme-dark .portal-layout > .content-stack > .panel .action-feedback {
  color: #fff;
}

/* Login screen centering */
body[data-page="portal"]:not(.portal-logged-in) .shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(12px, 2vw, 24px);
  box-sizing: border-box;
}

body[data-page="portal"]:not(.portal-logged-in) #portalGate {
  width: min(1500px, 100%);
  margin: 0 auto;
}

body[data-page="portal"]:not(.portal-logged-in) .gate-shell {
  width: 100%;
  flex: 1 1 auto;
  min-height: calc(100vh - clamp(28px, 4vw, 60px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

body[data-page="portal"]:not(.portal-logged-in) .gate-layout {
  width: min(1160px, 100%);
  min-height: min(640px, calc(100vh - clamp(44px, 6vw, 92px)));
  margin: 0;
  grid-template-columns: minmax(0, 1.38fr) minmax(320px, 0.92fr);
  gap: 14px;
}

body[data-page="portal"]:not(.portal-logged-in) .gate-copy-panel,
body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
  min-height: 100%;
}

body[data-page="portal"]:not(.portal-logged-in) .gate-copy-panel,
body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
  padding: 20px;
}

body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
  align-content: start;
  padding-top: 56px;
}

body[data-page="portal"]:not(.portal-logged-in) .portal-login-logo-wrap-inline {
  top: 14px;
  right: 16px;
}

body[data-page="portal"]:not(.portal-logged-in) .portal-login-logo-wrap-inline .portal-login-logo {
  width: 92px;
  max-width: 92px;
}

body[data-page="portal"]:not(.portal-logged-in) .gate-footer {
  position: static;
  width: min(1280px, calc(100% - 32px));
  margin: 12px auto 0;
  padding: 0 8px;
  z-index: 3;
  color: rgba(255,255,255,0.82);
  text-shadow: 0 1px 8px rgba(0,0,0,0.24);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

body[data-page="portal"]:not(.portal-logged-in) .gate-footer-links a {
  color: rgba(255,255,255,0.86);
}

@media (max-width: 1100px) {
  body[data-page="portal"]:not(.portal-logged-in) .gate-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  body[data-page="portal"]:not(.portal-logged-in) .foundation-highlight-strip {
    grid-template-columns: 1fr;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
    padding-top: 22px;
  }

  body[data-page="portal"]:not(.portal-logged-in) .portal-login-logo-wrap-inline {
    position: static;
    justify-self: end;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-footer {
    position: static;
    width: 100%;
    color: var(--muted);
    text-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

body[data-page="portal"]:not(.portal-logged-in) .gate-footer-links a {
    color: var(--text);
  }
}

.mobile-brand-row,
.mobile-pagebar,
.mobile-drawer-overlay,
.sidebar-mobile-close,
.mobile-dar-view,
.mobile-login-logo-wrap,
.mobile-login-tabs,
.mobile-login-about {
  display: none;
}

.mobile-login-signin {
  display: block;
}

@media (max-width: 768px) {
  body[data-page="portal"] {
    overflow-x: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f2f1ed;
  }

  body.theme-dark[data-page="portal"] {
    background: #121212;
  }

  body[data-page="portal"] .shell {
    width: 100%;
    padding: 0;
  }

  body[data-page="portal"] .login-slideshow {
    display: none;
  }

  body[data-page="portal"].portal-logged-in .portal-outer {
    display: grid;
  }

  .portal-outer {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    min-height: 100dvh;
    background: #f2f1ed;
    gap: 0 !important;
  }

  body.theme-dark .portal-outer {
    background: #121212;
  }

  .portal-outer > .portal-topbar,
  .portal-outer > .mobile-brand-row,
  .portal-outer > .mobile-pagebar,
  .portal-outer > .portal-alerts-full,
  .portal-outer > .portal-layout {
    grid-column: 1;
  }

  .portal-topbar {
    position: relative;
    z-index: 30;
    margin: 0 !important;
    padding: 14px 14px 12px;
    background: #c0002a;
    border: 0;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: flex-start;
    gap: 12px;
  }

  .portal-topbar-ghost {
    flex: 1 1 auto;
    min-height: auto;
    padding: 0;
  }

  .portal-topbar-ghost .ghost-stack {
    gap: 1px;
  }

  .portal-topbar-ghost .ghost-primary {
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
  }

  .portal-topbar-ghost .ghost-secondary {
    font-size: 1.02rem;
    line-height: 1.05;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  .portal-topbar-ghost .ghost-cursor {
    display: none;
  }

  .portal-topbar-actions {
    margin-left: auto;
    padding-top: 0;
    align-items: flex-start;
  }

  .portal-notification-toggle {
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #ffffff;
  }

  .portal-notification-toggle::before {
    color: #ffffff;
    font-size: 1rem;
  }

  .personal-progress-toggle {
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-color: transparent;
  }

  .personal-progress-icon {
    width: 28px;
    height: 28px;
    font-size: 0.82rem;
  }

  .personal-progress-badge {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    border-radius: 50%;
    background: #f0c300;
    color: transparent;
    font-size: 0;
    top: 1px;
    right: 1px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
  }

  .portal-notification-toggle .notification-badge {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    border-radius: 50%;
    background: #f0c300;
    color: transparent;
    font-size: 0;
    top: 1px;
    right: 1px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
  }

  .mobile-brand-row {
    padding: 10px 12px 8px;
    background: transparent;
  }

  .mobile-brand-pill {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
  }

  .mobile-brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
  }

  .mobile-brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #ffffff;
  }

  .mobile-brand-copy strong {
    font-size: 0.95rem;
    line-height: 1.05;
    font-weight: 700;
  }

  .mobile-brand-copy span {
    font-size: 0.68rem;
    line-height: 1.05;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.68);
  }

  .mobile-brand-badge {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.68rem;
    line-height: 1;
    white-space: nowrap;
  }

  .mobile-pagebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin: 0;
    background: #ffffff;
    border-top: 1px solid #ece7e1;
    border-bottom: 1px solid #e3ddd7;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 22;
  }

  body.theme-dark .mobile-pagebar {
    background: #1e1e1e;
    border-top-color: #2a2a2a;
    border-bottom-color: #2a2a2a;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  }

  .mobile-page-name {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #1a1a1a;
  }

  body.theme-dark .mobile-page-name {
    color: #f0f0f0;
  }

  .mobile-menu-toggle {
    width: 38px;
    height: 38px;
    border: 0;
    padding: 0;
    border-radius: 10px;
    background: transparent;
    display: grid;
    place-items: center;
    gap: 3px;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #1a1a1a;
  }

  body.theme-dark .mobile-menu-toggle span {
    background: #f0f0f0;
  }

  .portal-alerts-full {
    padding: 0 12px;
  }

  .portal-layout {
    display: block;
    position: relative;
    min-height: 0;
  }

  .portal-layout > .content-stack {
    padding: 12px 12px 24px;
  }

  .portal-layout > .content-stack > .panel {
    margin: 0 0 12px;
    border-radius: 16px;
  }

  .portal-layout > .content-stack > .panel:last-child {
    margin-bottom: 0;
  }

  .portal-layout > .sidebar,
  .portal-layout > .sidebar.panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 25vw;
    max-width: 25vw;
    min-width: 25vw;
    height: 100dvh;
    margin: 0;
    padding: 42px 6px 14px;
    background: #ffffff !important;
    color: #1a1a1a;
    border-left: 1px solid #e5e2de;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 240ms ease;
    z-index: 60;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.14);
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
  }

  body.theme-dark .portal-layout > .sidebar,
  body.theme-dark .portal-layout > .sidebar.panel {
    background: #1c1c1e !important;
    color: rgba(255, 255, 255, 0.92);
    border-left-color: rgba(255, 255, 255, 0.05);
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.38);
  }

  body.mobile-drawer-open .portal-layout > .sidebar,
  body.mobile-drawer-open .portal-layout > .sidebar.panel {
    transform: translateX(0);
  }

  .mobile-brand-row,
  .mobile-pagebar,
  .mobile-drawer-overlay,
  .sidebar-mobile-close,
  .mobile-menu-toggle {
    display: none !important;
  }

  .portal-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    position: relative;
    min-height: 0;
    padding: 12px 12px 24px;
  }

  .portal-layout > .content-stack {
    padding: 0;
  }

  .portal-layout > .content-stack > .panel {
    margin: 0 0 12px;
    border-radius: 16px;
  }

  .portal-layout > .content-stack > .panel:last-child {
    margin-bottom: 0;
  }

  .portal-layout > .sidebar,
  .portal-layout > .sidebar.panel {
    position: relative;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 12px 12px 14px;
    background: #ffffff !important;
    color: #1a1a1a;
    border: 1px solid #e5e2de;
    border-radius: 16px;
    transform: none;
    transition: none;
    z-index: 1;
    overflow: visible;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  body.theme-dark .portal-layout > .sidebar,
  body.theme-dark .portal-layout > .sidebar.panel {
    background: #1c1c1e !important;
    color: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.38);
  }

  .sidebar-logo-block {
    display: flex;
    width: 100%;
    min-height: 62px;
    padding: 0;
    justify-content: center;
    align-items: center;
    gap: 8px;
  }

  .sidebar-logo-img {
    width: 88px;
    max-height: 52px;
    object-fit: contain;
  }

  .identity-strip {
    display: grid;
    width: 100%;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.03);
    text-align: center;
  }

  body.theme-dark .identity-strip {
    background: rgba(255, 255, 255, 0.04);
  }

  .identity-strip div:first-child {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .identity-strip div:last-child {
    font-size: 0.66rem;
    color: rgba(26, 26, 26, 0.62);
  }

  body.theme-dark .identity-strip div:last-child {
    color: rgba(255, 255, 255, 0.62);
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  body.mobile-drawer-open .portal-layout > .sidebar,
  body.mobile-drawer-open .portal-layout > .sidebar.panel {
    transform: none;
  }

  .sidebar-nav {
    display: grid !important;
    grid-auto-rows: min-content;
    padding: 0;
    gap: 6px;
    margin-top: 0;
    flex: 0 0 auto;
    width: 100%;
  }

  .sidebar-nav button {
    width: 100%;
    min-height: 42px;
    padding: 5px 6px;
    border-radius: 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.02);
    color: rgba(26, 26, 26, 0.82);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
  }

  body.theme-dark .sidebar-nav button {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.72);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .sidebar-nav button.active-section {
    background: #c0002a;
    color: #ffffff;
    border-color: #c0002a;
  }

  .nav-item-icon {
    width: auto;
    min-width: 0;
    margin: 0;
    font-size: 0.88rem;
    line-height: 1;
  }

  .sidebar-nav button span:last-child {
    display: block;
    font-size: 0.62rem;
    line-height: 1.05;
    letter-spacing: 0.02em;
    text-align: left;
    white-space: normal;
    max-width: 100%;
  }

  .sidebar-bottom-actions {
    margin-top: 4px;
    padding: 8px 0 0;
    gap: 8px;
    border-top: 0;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    width: 100%;
    align-items: stretch;
  }

  .theme-switch-wrapper {
    display: flex;
    padding: 2px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.06);
    width: 100%;
  }

  body.theme-dark .theme-switch-wrapper {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.06);
  }

  .theme-switch-btn {
    flex: 1 1 0;
    min-height: 30px;
    padding: 0 6px;
    border-radius: 999px;
    border: 0;
    box-shadow: none !important;
    background: transparent !important;
    color: rgba(26, 26, 26, 0.46) !important;
    font-size: 0.76rem;
  }

  body.theme-dark .theme-switch-btn {
    color: rgba(255, 255, 255, 0.4) !important;
  }

  .theme-switch-btn.is-active {
    box-shadow: none !important;
  }

  body.theme-dark .light-btn.is-active {
    background: #c0002a !important;
    color: #ffffff !important;
  }

  body.theme-dark .dark-btn.is-active {
    background: transparent !important;
    color: rgba(255, 255, 255, 0.3) !important;
  }

  body:not(.theme-dark) .light-btn.is-active {
    background: #ffffff !important;
    color: #333333 !important;
  }

  body:not(.theme-dark) .dark-btn.is-active {
    background: transparent !important;
    color: rgba(255, 255, 255, 0.4) !important;
  }

  .sidebar-quick-action {
    width: 100%;
    padding: 8px 10px;
    min-height: 44px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
    overflow: hidden;
  }

  body.theme-dark .sidebar-quick-action {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
  }

  .sidebar-profile-button {
    order: 2;
    grid-template-columns: auto;
    justify-items: center;
  }

  #sidebarSignOutButton {
    order: 3;
    color: #c0002a;
    border-color: rgba(192, 0, 42, 0.4);
    background: rgba(192, 0, 42, 0.06);
  }

  body.theme-dark #sidebarSignOutButton {
    color: #ff788d;
    background: rgba(192, 0, 42, 0.08);
  }

  .sidebar-signout-icon {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(192, 0, 42, 0.16);
    color: #ff5e79;
  }

  .sidebar-quick-copy,
  .sidebar-profile-copy strong {
    font-size: 0.78rem;
  }

  .sidebar-profile-copy {
    display: none;
  }

  .sidebar-profile-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #c0002a !important;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    background-image: none !important;
  }

  body.theme-dark .sidebar-profile-avatar {
    background: #c0002a !important;
    color: #ffffff;
  }

  .sidebar-signout-icon svg {
    width: 16px;
    height: 16px;
  }

  .sidebar-bottom-actions > .theme-switch-wrapper {
    order: 1;
  }

  .mobile-dar-view {
    display: block;
  }

  #darModeSwitcher {
    display: flex !important;
    gap: 10px;
    padding: 0 12px 12px;
    margin: 0;
  }

  #darModeSwitcher .compact-button {
    flex: 1 1 0;
    min-height: 38px;
    border-radius: 999px;
    background: #ffffff;
    color: #555555;
    border: 1px solid #dddddd;
  }

  #darModeSwitcher .compact-button.active-mode {
    background: #c0002a;
    color: #ffffff;
    border-color: #c0002a;
  }

  body.theme-dark #darModeSwitcher .compact-button {
    background: #1e1e1e;
    color: #aaaaaa;
    border-color: #333333;
  }

  body.theme-dark #darModeSwitcher .compact-button.active-mode {
    background: #c0002a;
    color: #ffffff;
    border-color: #c0002a;
  }

  .mobile-dar-form {
    display: grid;
    gap: 12px;
  }

  .mobile-dar-card-grid {
    display: grid;
    gap: 10px;
  }

  .mobile-dar-field {
    display: grid;
    gap: 8px;
    padding: 12px 12px 10px;
    border-radius: 8px;
    border: 1px solid #e2e2e2;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
  }

  body.theme-dark .mobile-dar-field {
    background: #1e1e1e;
    border-color: #2a2a2a;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
  }

  .mobile-dar-field > span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #aaaaaa;
  }

  .mobile-dar-field > span i {
    font-size: 0.78rem;
  }

  .mobile-dar-field input,
  .mobile-dar-field select {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    min-height: 24px;
    font-size: 0.96rem;
    color: #222222;
    appearance: none;
  }

  .mobile-dar-field input::placeholder,
  .mobile-dar-field select:invalid {
    color: #cccccc;
  }

  body.theme-dark .mobile-dar-field input,
  body.theme-dark .mobile-dar-field select {
    color: #e0e0e0;
  }

  body.theme-dark .mobile-dar-field input::placeholder,
  body.theme-dark .mobile-dar-field select:invalid {
    color: #444444;
  }

  .mobile-dar-submit {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    background: #c0002a;
    color: #ffffff;
    border: 0;
    box-shadow: 0 12px 24px rgba(192, 0, 42, 0.2);
  }

  .mobile-dar-submit.button-secondary {
    background: #c0002a;
    color: #ffffff;
  }

  .dar-workspace {
    display: none;
  }

  .mobile-dar-view.hidden {
    display: none;
  }

  .panel,
  .assignment-card,
  .report-card,
  .metric-tile,
  .stat-card,
  .overview-analytics-card,
  .hierarchy-card,
  .profile-summary-card,
  .profile-about-card,
  .profile-activity-card,
  .profile-achievements-card,
  .profile-edit-card,
  .history-table-shell,
  .history-drawer-stack,
  .compliance-expanded-card,
  .announcement-popover,
  .festival-banner,
  .sidebar-bottom-actions {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
  }

  body.theme-dark .panel,
  body.theme-dark .assignment-card,
  body.theme-dark .report-card,
  body.theme-dark .metric-tile,
  body.theme-dark .stat-card,
  body.theme-dark .overview-analytics-card,
  body.theme-dark .hierarchy-card,
  body.theme-dark .profile-summary-card,
  body.theme-dark .profile-about-card,
  body.theme-dark .profile-activity-card,
  body.theme-dark .profile-achievements-card,
  body.theme-dark .profile-edit-card,
  body.theme-dark .history-table-shell,
  body.theme-dark .history-drawer-stack,
  body.theme-dark .compliance-expanded-card,
  body.theme-dark .announcement-popover,
  body.theme-dark .festival-banner {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
    background: linear-gradient(180deg, rgba(28, 28, 34, 0.98), rgba(20, 20, 24, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.42);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-tabs {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-tab {
    color: rgba(255, 255, 255, 0.7);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-tab.is-active {
    background: linear-gradient(135deg, rgba(181, 31, 59, 0.95), rgba(139, 10, 26, 0.98));
    color: #fff8ea;
    box-shadow: 0 8px 18px rgba(181, 31, 59, 0.24);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin .section-tag,
  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-about .section-tag {
    color: rgba(216, 166, 59, 0.78);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin h2,
  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-about h2 {
    color: #ffffff;
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin .gate-intro,
  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-about .gate-intro,
  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin .helper-text {
    color: rgba(255, 255, 255, 0.64);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin label {
    color: rgba(255, 255, 255, 0.82);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-stat-card,
  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-value-row {
    background: rgba(24, 24, 28, 0.96);
    border-color: rgba(255, 255, 255, 0.08);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-stat-card strong,
  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-value-row strong {
    color: #ffffff;
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-stat-card span,
  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-value-row p {
    color: rgba(255, 255, 255, 0.68);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-value-icon {
    background: rgba(181, 31, 59, 0.18);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-value-icon i {
    color: #ffd66a;
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin input {
    background: rgba(15, 15, 18, 0.98);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin input::placeholder {
    color: rgba(255, 255, 255, 0.42);
  }

  body.theme-dark[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin .button {
    background: linear-gradient(135deg, rgba(181, 31, 59, 0.95), rgba(139, 10, 26, 1));
    color: #fff8ea;
  }
}

@media (max-width: 768px) {
  body[data-page="portal"].portal-logged-in .portal-layout {
    overflow-x: hidden !important;
  }

  body[data-page="portal"].portal-logged-in .portal-layout > .sidebar,
  body[data-page="portal"].portal-logged-in .portal-layout > .sidebar.panel {
    width: clamp(220px, 58vw, 300px) !important;
    min-width: clamp(220px, 58vw, 300px) !important;
    max-width: clamp(220px, 58vw, 300px) !important;
    overflow-x: hidden !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav {
    overflow-x: hidden !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav button {
    padding: 6px 4px !important;
    min-height: 38px !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav button span:last-child {
    font-size: 0.52rem !important;
    line-height: 1 !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body[data-page="portal"].portal-logged-in .nav-item-icon {
    font-size: 0.76rem !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-bottom-actions {
    gap: 6px !important;
    padding-top: 6px !important;
  }

  body[data-page="portal"].portal-logged-in .theme-switch-btn {
    font-size: 0.58rem !important;
  }

  body[data-page="portal"].portal-logged-in .theme-switch-btn .toggle-text {
    font-size: 0.58rem !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-profile-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.7rem !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-quick-action {
    min-height: 38px !important;
    padding: 7px 8px !important;
  }
}

@media (max-width: 768px) {
  body[data-page="portal"].portal-logged-in #orgOverviewSection .stats-grid,
  body[data-page="portal"].portal-logged-in #orgOverviewSection .overview-hub,
  body[data-page="portal"].portal-logged-in #orgOverviewSection .overview-analytics-grid {
    grid-template-columns: 1fr !important;
  }

  body[data-page="portal"].portal-logged-in #orgOverviewSection .overview-stream,
  body[data-page="portal"].portal-logged-in #orgOverviewSection .overview-metrics-stack {
    width: 100%;
  }

  body[data-page="portal"].portal-logged-in #orgOverviewSection .overview-hub {
    gap: 12px;
  }

  body[data-page="portal"].portal-logged-in #complianceSection .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-list {
    display: grid;
    gap: 12px;
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-card {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    box-shadow: var(--shadow);
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-meta {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--muted);
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-grid > div {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--line);
  }

  body.theme-dark[data-page="portal"].portal-logged-in .compliance-mobile-grid > div {
    background: rgba(40, 40, 50, 0.98);
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-grid span {
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    color: var(--muted);
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-grid strong {
    display: block;
    font-size: 0.9rem;
    line-height: 1.2;
  }

  body[data-page="portal"].portal-logged-in .compliance-mobile-details {
    margin-top: 12px;
  }

  body[data-page="portal"].portal-logged-in #complianceTable {
    overflow-x: hidden !important;
  }
}

@media (max-width: 768px) {
  body[data-page="portal"].portal-logged-in .mobile-brand-row {
    display: block !important;
    padding: 10px 12px 8px !important;
    background: transparent !important;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-pill {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-logo {
    width: 38px;
    height: 38px;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-copy strong {
    font-size: 0.92rem;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-copy span {
    font-size: 0.64rem;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-badge {
    padding: 6px 9px;
    font-size: 0.64rem;
  }

  body[data-page="portal"].portal-logged-in .mobile-pagebar {
    display: flex !important;
  }

  body[data-page="portal"].portal-logged-in .mobile-menu-toggle span {
    background: #d8c9ae !important;
  }

  body[data-page="portal"].portal-logged-in .portal-layout {
    padding-top: 10px;
  }

  body[data-page="portal"].portal-logged-in .dar-workspace,
  body[data-page="portal"].portal-logged-in #darSelfView,
  body[data-page="portal"].portal-logged-in #darSection {
    display: block !important;
  }

  body[data-page="portal"].portal-logged-in #darMobileView {
    display: none !important;
  }

  body[data-page="portal"].portal-logged-in .dar-form-panel {
    display: grid !important;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  body[data-page="portal"].portal-logged-in .portal-layout > .sidebar,
  body[data-page="portal"].portal-logged-in .portal-layout > .sidebar.panel {
    background: #f5efe6 !important;
    color: #1f1a16 !important;
    border-left: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.14) !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .portal-layout > .sidebar,
  body.theme-dark[data-page="portal"].portal-logged-in .portal-layout > .sidebar.panel {
    background: #1c1c1e !important;
    color: rgba(255, 255, 255, 0.92) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.38) !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-mobile-close {
    background: rgba(255, 255, 255, 0.72) !important;
    color: #7a6d5d !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .sidebar-mobile-close {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.72) !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav button {
    background: rgba(255, 255, 255, 0.78) !important;
    color: #4a4036 !important;
    border: 1px solid rgba(192, 0, 42, 0.08) !important;
    box-shadow: none !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .sidebar-nav button {
    background: rgba(255, 255, 255, 0.06) !important;
    color: rgba(255, 255, 255, 0.86) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav button.active-section {
    background: #c0002a !important;
    color: #ffffff !important;
    border-color: #c0002a !important;
  }

  body[data-page="portal"].portal-logged-in .sidebar-nav button.active-section .nav-item-icon {
    color: #ffffff !important;
  }

  body[data-page="portal"].portal-logged-in .theme-switch-wrapper {
    background: rgba(255, 255, 255, 0.78) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .theme-switch-wrapper {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
  }

  body[data-page="portal"].portal-logged-in .theme-switch-btn {
    color: rgba(74, 64, 54, 0.72) !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .theme-switch-btn {
    color: rgba(255, 255, 255, 0.78) !important;
  }

  body[data-page="portal"].portal-logged-in .theme-switch-btn.is-active {
    background: #ffffff !important;
    color: #333333 !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .theme-switch-btn.is-active {
    background: #c0002a !important;
    color: #ffffff !important;
  }

  body[data-page="portal"].portal-logged-in #sidebarSignOutButton {
    background: rgba(192, 0, 42, 0.08) !important;
    border: 1px solid rgba(192, 0, 42, 0.34) !important;
    color: #c0002a !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in #sidebarSignOutButton {
    background: rgba(192, 0, 42, 0.12) !important;
    border: 1px solid rgba(192, 0, 42, 0.38) !important;
    color: #ff8a9a !important;
  }

  body[data-page="portal"].portal-logged-in .theme-switch-btn {
    font-size: 0.62rem !important;
    line-height: 1 !important;
    letter-spacing: 0.01em !important;
  }

  body[data-page="portal"].portal-logged-in .theme-switch-btn .toggle-text {
    font-size: 0.62rem !important;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-ghost .ghost-primary {
    font-size: 0.9rem !important;
    line-height: 1.02 !important;
    letter-spacing: 0.08em !important;
    font-weight: 700 !important;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-ghost .ghost-secondary {
    font-size: 0.76rem !important;
    line-height: 1.02 !important;
    font-weight: 600 !important;
  }
}

@media (max-width: 768px) {
  body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-tabs {
    margin: 0;
    flex: 0 0 auto;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-panel {
    position: relative;
    inset: auto;
    display: none;
    min-height: 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: none;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-panel:not(.hidden) {
    display: flex;
    animation: mobileLoginFade 220ms ease both;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-panel.hidden {
    display: none !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin,
  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-about {
    flex: 1 1 auto;
  }

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

@media (max-width: 768px) {
  body[data-page="portal"]:not(.portal-logged-in) {
    overflow: hidden;
    height: 100dvh;
    background: #121212;
  }

  body[data-page="portal"]:not(.portal-logged-in) .portal-topbar,
  body[data-page="portal"]:not(.portal-logged-in) .portal-alerts-full {
    display: none !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-shell {
    padding: 18px 0 12px;
    gap: 14px;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo-wrap {
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 0 0 16px;
    padding: 0 12px;
    position: relative;
    z-index: 2;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo-card {
    width: 96px;
    min-height: 62px;
    display: grid;
    place-items: center;
    padding: 8px 10px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo {
    width: 72px;
    max-width: 72px;
    display: block;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-layout {
    width: min(92vw, 380px);
    margin: 0 auto;
    min-height: calc(100dvh - 138px);
    max-height: calc(100dvh - 138px);
    grid-template-columns: 1fr;
    gap: 0;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-copy-panel,
  body[data-page="portal"]:not(.portal-logged-in) .portal-login-logo-wrap-inline {
    display: none !important;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
    min-height: 100%;
    position: relative;
    overflow: hidden;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.14);
  }

  .mobile-login-tabs {
    display: flex !important;
    align-items: center;
    gap: 4px;
    padding: 4px;
    margin: 0 0 14px;
    border-radius: 999px;
    background: #f0eeea;
  }

  .mobile-login-tab {
    flex: 1 1 0;
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #777777;
    font-size: 0.82rem;
    font-weight: 700;
  }

  .mobile-login-tab.is-active {
    background: #c0002a;
    color: #ffffff;
  }

  .mobile-login-panel {
    position: absolute;
    inset: 66px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateX(16px);
    pointer-events: none;
    will-change: transform, opacity;
    transition: transform 300ms ease, opacity 300ms ease;
  }

  .mobile-login-panel.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .mobile-login-signin {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  body.mobile-login-about-open .mobile-login-signin {
    opacity: 0;
    transform: translateX(-16px);
    pointer-events: none;
  }

  .mobile-login-about {
    transform: translateX(16px);
  }

  body.mobile-login-about-open .mobile-login-about {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-login-signin .panel-header {
    margin: 0;
    padding: 0;
  }

  .mobile-login-signin .section-tag,
  .mobile-login-about .section-tag {
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    margin-bottom: 4px;
  }

  .mobile-login-signin h2,
  .mobile-login-about h2 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.06;
  }

  .mobile-login-signin .gate-intro,
  .mobile-login-about .gate-intro {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.22;
    color: #777777;
  }

  .mobile-login-signin .gate-form {
    gap: 9px;
  }

  .mobile-login-signin label {
    font-size: 0.84rem;
  }

  .mobile-login-signin input {
    min-height: 44px;
    border-radius: 12px;
  }

  .mobile-login-signin .button {
    min-height: 44px;
    border-radius: 999px;
  }

  .mobile-login-signin .helper-text {
    margin: 0;
    font-size: 0.74rem;
    font-style: italic;
    line-height: 1.25;
  }

  .mobile-login-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-login-stat-card {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #e2e2e2;
    background: #ffffff;
  }

  .mobile-login-value-list {
    display: grid;
    gap: 8px;
  }

  .mobile-login-value-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #ece7e1;
    background: rgba(255, 255, 255, 0.84);
  }

  .mobile-login-value-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fdf0f0;
  }

  .mobile-login-value-icon i {
    color: #c0002a;
    font-size: 0.9rem;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-footer {
    margin: 0;
    padding: 0 10px 8px;
    color: rgba(255, 255, 255, 0.55);
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-footer-links {
    display: none;
  }
}

@media (max-width: 768px) {
  body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-tabs {
    margin: 0;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-panel {
    position: relative !important;
    inset: auto !important;
    display: none;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: none;
    width: 100%;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-panel:not(.hidden) {
    display: flex;
    animation: mobileLoginFade 220ms ease both;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin,
  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-about {
    flex: 1 1 auto;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-signin .panel-header,
  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-about .panel-header {
    margin-top: 0;
  }

  @keyframes mobileLoginFade {
    from {
      opacity: 0;
      transform: translateX(8px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
}
body.theme-dark .sidebar-mobile-close {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.78);
  }

@media (max-width: 768px) {
  body[data-page="portal"] {
    overflow-x: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  body[data-page="portal"]:not(.portal-logged-in) {
    overflow: hidden;
    height: 100dvh;
    background: #121212;
  }

  body[data-page="portal"] .shell {
    width: 100%;
    padding: 0;
  }

  body[data-page="portal"] .login-slideshow {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
  }

  body[data-page="portal"].portal-logged-in .login-slideshow {
    display: none;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-shell {
    min-height: 100dvh;
    justify-content: space-between;
    padding: 0;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-layout {
    width: min(92vw, 380px);
    min-height: calc(100dvh - 74px);
    margin: 0 auto;
    grid-template-columns: 1fr;
    gap: 0;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-copy-panel {
    display: none;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-auth-panel {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    overflow: hidden;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo-wrap {
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 0 0 12px;
    padding: 0 12px;
    position: relative;
    z-index: 2;
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo-card {
    width: 96px;
    min-height: 62px;
    display: grid;
    place-items: center;
    padding: 8px 10px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  }

  body[data-page="portal"]:not(.portal-logged-in) .mobile-login-logo {
    width: 72px;
    max-width: 72px;
    display: block;
  }

  .mobile-login-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: #f0eeea;
    margin: 0 0 12px;
  }

  .mobile-login-tab {
    flex: 1 1 0;
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #777777;
    font-size: 0.82rem;
    font-weight: 700;
  }

  .mobile-login-tab.is-active {
    background: #c0002a;
    color: #ffffff;
  }

  .mobile-login-panel {
    position: relative;
    inset: auto;
    display: none;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: none;
    will-change: auto;
  }

  .mobile-login-panel.hidden {
    display: none !important;
  }

  .mobile-login-panel:not(.hidden) {
    display: flex;
    animation: mobileLoginFade 220ms ease both;
  }

  body.mobile-login-about-open .mobile-login-signin,
  body.mobile-login-about-open .mobile-login-about {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-login-signin .panel-header {
    margin: 0;
    padding: 0;
  }

  .mobile-login-signin .section-tag,
  .mobile-login-about .section-tag {
    font-size: 0.68rem;
    letter-spacing: 0.18em;
  }

  .mobile-login-signin h2 {
    font-size: 1.34rem;
    line-height: 1.05;
  }

  .mobile-login-about h2 {
    font-size: 1.12rem;
    line-height: 1.1;
    margin: 0;
  }

  .mobile-login-signin .gate-intro,
  .mobile-login-about .gate-intro {
    font-size: 0.82rem;
    line-height: 1.26;
    margin: 0;
  }

  .mobile-login-signin .gate-form {
    gap: 10px;
  }

  .mobile-login-signin label {
    font-size: 0.86rem;
  }

  .mobile-login-signin input {
    min-height: 46px;
    border-radius: 12px;
  }

  .mobile-login-signin .button {
    min-height: 46px;
    border-radius: 999px;
  }

  .mobile-login-signin .helper-text {
    margin: 0;
    font-size: 0.76rem;
    font-style: italic;
  }

  @keyframes mobileLoginFade {
    from {
      opacity: 0;
      transform: translateX(8px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .mobile-login-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-login-stat-card {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #e2e2e2;
    background: #ffffff;
  }

  .mobile-login-stat-card strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 2px;
  }

  .mobile-login-stat-card span {
    display: block;
    font-size: 0.72rem;
    color: #777777;
    line-height: 1.2;
  }

  .mobile-login-value-list {
    display: grid;
    gap: 8px;
  }

  .mobile-login-value-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #ece7e1;
    background: rgba(255, 255, 255, 0.8);
  }

  .mobile-login-value-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fdf0f0;
    font-size: 1rem;
  }

  .mobile-login-value-icon i {
    color: #c0002a;
    font-size: 0.92rem;
  }

  .mobile-login-value-row strong {
    display: block;
    font-size: 0.94rem;
    line-height: 1.1;
  }

  .mobile-login-value-row p {
    margin: 2px 0 0;
    font-size: 0.76rem;
    line-height: 1.2;
    color: #777777;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-footer {
    position: relative;
    width: 100%;
    margin: 6px 0 0;
    padding: 0 8px 8px;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
    z-index: 2;
  }

  body[data-page="portal"]:not(.portal-logged-in) .gate-footer-links {
    display: none;
  }

  body[data-page="portal"]:not(.portal-logged-in) .portal-topbar,
  body[data-page="portal"]:not(.portal-logged-in) .portal-alerts-full {
    display: none;
  }

  body[data-page="portal"].portal-logged-in .mobile-brand-row {
    display: none;
  }

  body[data-page="portal"].portal-logged-in .mobile-pagebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin: 0;
    background: #ffffff;
    border-top: 1px solid #ece7e1;
    border-bottom: 1px solid #e3ddd7;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 22;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .mobile-pagebar {
    background: #1e1e1e;
    border-top-color: #2a2a2a;
    border-bottom-color: #2a2a2a;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  }

  body[data-page="portal"].portal-logged-in .mobile-menu-toggle {
    display: grid;
    width: 38px;
    height: 38px;
    border: 0;
    padding: 0;
    border-radius: 10px;
    background: transparent;
    place-items: center;
    gap: 3px;
  }

  body[data-page="portal"].portal-logged-in .mobile-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #cbbca6;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .mobile-menu-toggle span {
    background: #f0f0f0;
  }

  .mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.26);
    z-index: 55;
  }

  body.mobile-drawer-open .mobile-drawer-overlay {
    display: block;
  }

  .portal-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    position: relative;
    min-height: 0;
    padding: 12px;
  }

  .portal-layout > .content-stack {
    width: 100%;
    padding: 0;
  }

  .portal-layout > .content-stack > .panel {
    margin: 0 0 12px;
    border-radius: 16px;
  }

  .portal-layout > .content-stack > .panel:last-child {
    margin-bottom: 0;
  }

  .portal-layout > .sidebar,
  .portal-layout > .sidebar.panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 25vw;
    max-width: 25vw;
    min-width: 25vw;
    height: 100dvh;
    margin: 0;
    padding: 42px 6px 14px;
    background: #f3efe7 !important;
    color: #1a1a1a;
    border-left: 1px solid #ddd5c7;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 240ms ease;
    z-index: 60;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.16);
    display: flex !important;
    flex-direction: column;
    align-items: center;
  }

  body.theme-dark .portal-layout > .sidebar,
  body.theme-dark .portal-layout > .sidebar.panel {
    background: #1c1c1e !important;
    color: rgba(255, 255, 255, 0.92);
    border-left-color: rgba(255, 255, 255, 0.05);
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.38);
  }

  body.mobile-drawer-open .portal-layout > .sidebar,
  body.mobile-drawer-open .portal-layout > .sidebar.panel {
    transform: translateX(0);
  }

  .sidebar-mobile-close {
    display: grid;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    color: #6d6557;
    place-items: center;
    z-index: 1;
  }

  body.theme-dark .sidebar-mobile-close {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.78);
  }

  .sidebar-logo-block {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
  }

  .sidebar-logo-img {
    width: 48px;
    max-height: 48px;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  .identity-strip {
    width: 100%;
    text-align: center;
    justify-items: center;
    padding: 8px 6px;
    border-radius: 12px;
  }

  .sidebar-nav {
    display: grid !important;
    width: 100%;
    gap: 6px;
    padding: 0;
    margin-top: 0;
  }

  .sidebar-nav button {
    width: 100%;
    min-height: 40px;
    padding: 6px 4px;
    justify-content: center;
    gap: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    color: #3d372f;
    border: 1px solid rgba(192, 0, 42, 0.08);
  }

  .sidebar-nav button.active-section {
    background: #c0002a;
    color: #ffffff;
    border-color: #c0002a;
    box-shadow: 0 10px 18px rgba(192, 0, 42, 0.18);
  }

  .sidebar-nav button span:last-child {
    font-size: 0.56rem;
    line-height: 1.05;
    text-align: center;
  }

  .nav-item-icon {
    font-size: 0.78rem;
    color: inherit;
  }

  .sidebar-bottom-actions {
    width: 100%;
    gap: 8px;
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-profile-copy {
    display: none;
  }

  .sidebar-profile-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
  }

  .sidebar-quick-action {
    width: 100%;
    min-height: 42px;
    padding: 8px 8px;
    border-radius: 12px;
  }

  .theme-switch-wrapper {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.06);
  }

  .theme-switch-btn {
    background: transparent !important;
    color: #6d6557 !important;
  }

  .theme-switch-btn.is-active {
    background: #ffffff !important;
    color: #333333 !important;
  }

  .sidebar-profile-button.sidebar-quick-action {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(0, 0, 0, 0.08);
  }

  #sidebarSignOutButton {
    color: #c0002a;
    border-color: rgba(192, 0, 42, 0.3);
    background: rgba(192, 0, 42, 0.08);
  }

  .theme-switch-wrapper {
    width: 100%;
  }

  .portal-layout > .content-stack > .panel,
  .panel {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
  }

  body.theme-dark .portal-layout > .content-stack > .panel,
  body.theme-dark .panel {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
  }
}

@media (max-width: 768px) {
  body[data-page="portal"] {
    overflow-x: hidden;
    background: #f2f1ed;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  body.theme-dark[data-page="portal"] {
    background: #121212;
  }

  body[data-page="portal"] .shell {
    width: 100%;
    padding: 0;
  }

  body[data-page="portal"].portal-logged-in .portal-outer {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }

  .mobile-brand-row,
  .mobile-pagebar,
  .mobile-drawer-overlay,
  .sidebar-mobile-close,
  .mobile-menu-toggle,
  .mobile-dar-view {
    display: none !important;
  }

  .portal-topbar {
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(252, 246, 240, 0.9));
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 18px rgba(17, 17, 17, 0.07);
    align-items: center;
  }

  body.theme-dark .portal-topbar {
    background: linear-gradient(135deg, rgba(26, 26, 28, 0.98), rgba(20, 20, 22, 0.96));
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.32);
  }

  .portal-topbar-ghost .ghost-primary {
    font-size: 0.74rem;
    letter-spacing: 0.15em;
    color: rgba(0, 0, 0, 0.42);
  }

  body.theme-dark .portal-topbar-ghost .ghost-primary {
    color: rgba(255, 255, 255, 0.48);
  }

  .portal-topbar-ghost .ghost-secondary {
    font-size: 0.98rem;
    line-height: 1.06;
  }

  .portal-layout {
    display: grid;
    grid-template-columns: minmax(0, 760px);
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px 12px 24px;
    box-sizing: border-box;
  }

  .portal-layout > .content-stack {
    width: 100%;
    padding: 0;
    display: grid;
    gap: 12px;
  }

  .portal-layout > .content-stack > .panel {
    margin: 0;
    border-radius: 16px;
  }

  .portal-layout > .sidebar,
  .portal-layout > .sidebar.panel {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 12px 12px 14px;
    border: 1px solid #e5e2de;
    border-radius: 16px;
    transform: none;
    transition: none;
    overflow: visible;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    align-items: center;
    gap: 10px;
  }

  body.theme-dark .portal-layout > .sidebar,
  body.theme-dark .portal-layout > .sidebar.panel {
    background: #1c1c1e !important;
    color: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.38);
  }

  .sidebar-logo-block {
    width: 100%;
    min-height: 60px;
    padding: 0;
    justify-content: center;
    align-items: center;
  }

  .sidebar-logo-img {
    width: 74px;
    max-height: 48px;
    margin: 0 auto;
    object-fit: contain;
  }

  .identity-strip {
    width: 100%;
    text-align: center;
    justify-items: center;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .sidebar-nav {
    width: 100%;
    display: grid !important;
    gap: 6px;
    padding: 0;
    margin-top: 0;
  }

  .sidebar-nav button {
    width: 100%;
    min-height: 42px;
    padding: 6px 10px;
    border-radius: 12px;
    justify-content: center;
    gap: 6px;
    text-align: center;
  }

  .sidebar-nav button span:last-child {
    font-size: 0.68rem;
    line-height: 1.05;
    text-align: center;
  }

  .nav-item-icon {
    font-size: 0.86rem;
  }

  .sidebar-bottom-actions {
    width: 100%;
    margin-top: 4px;
    padding-top: 8px;
    gap: 8px;
  }

  .theme-switch-wrapper {
    width: 100%;
  }

  .sidebar-quick-action {
    width: 100%;
  }

  .sidebar-profile-copy {
    display: none;
  }

  .sidebar-profile-avatar {
    width: 32px;
    height: 32px;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  .portal-alerts-full {
    padding: 0 12px;
  }

  .panel,
  .assignment-card,
  .report-card,
  .metric-tile,
  .stat-card,
  .overview-analytics-card,
  .hierarchy-card,
  .profile-summary-card,
  .profile-about-card,
  .profile-activity-card,
  .profile-achievements-card,
  .profile-edit-card,
  .history-table-shell,
  .history-drawer-stack,
  .compliance-expanded-card,
  .announcement-popover,
  .festival-banner,
  .sidebar-bottom-actions {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
  }

  body.theme-dark .panel,
  body.theme-dark .assignment-card,
  body.theme-dark .report-card,
  body.theme-dark .metric-tile,
  body.theme-dark .stat-card,
  body.theme-dark .overview-analytics-card,
  body.theme-dark .hierarchy-card,
  body.theme-dark .profile-summary-card,
  body.theme-dark .profile-about-card,
  body.theme-dark .profile-activity-card,
  body.theme-dark .profile-achievements-card,
  body.theme-dark .profile-edit-card,
  body.theme-dark .history-table-shell,
  body.theme-dark .history-drawer-stack,
  body.theme-dark .compliance-expanded-card,
  body.theme-dark .announcement-popover,
body.theme-dark .festival-banner {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
  }
}

@media (max-width: 900px) {
  .portal-topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .personal-progress-panel {
    width: min(320px, calc(100vw - 18px));
    right: 0;
  }
}

@media (max-width: 768px) {
  .portal-topbar-actions {
    align-items: flex-start;
  }

  .personal-progress-toggle,
  .portal-notification-toggle {
    width: 34px;
    height: 34px;
  }

  .personal-progress-icon {
    width: 28px;
    height: 28px;
    font-size: 0.82rem;
  }

  .personal-progress-badge {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    border-radius: 50%;
    background: #f0c300;
    color: transparent;
    font-size: 0;
    top: 1px;
    right: 1px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
  }

  .personal-progress-panel {
    left: auto;
    right: 0;
    width: min(300px, calc(100vw - 16px));
  }

  .personal-progress-summary {
    grid-template-columns: 1fr;
  }

  .personal-progress-bar-copy {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  body[data-page="portal"].portal-logged-in .portal-topbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 241, 236, 0.98));
    border-bottom: 1px solid rgba(17, 17, 17, 0.08);
    animation: mobile-topbar-enter 420ms ease-out;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .portal-topbar {
    background: linear-gradient(135deg, rgba(24, 24, 27, 0.98), rgba(17, 17, 20, 0.96));
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  .portal-topbar-ghost {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    max-width: calc(100vw - 112px);
  }

  .portal-topbar-ghost .ghost-stack {
    width: 100%;
    gap: 2px;
  }

  .portal-topbar-ghost .ghost-primary,
  .portal-topbar-ghost .ghost-secondary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-shadow: none;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-ghost .ghost-primary {
    color: rgba(17, 17, 17, 0.72) !important;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-ghost .ghost-secondary {
    color: rgba(17, 17, 17, 0.96) !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .portal-topbar-ghost .ghost-primary {
    color: rgba(255, 255, 255, 0.5) !important;
  }

  body.theme-dark[data-page="portal"].portal-logged-in .portal-topbar-ghost .ghost-secondary {
    color: rgba(255, 255, 255, 0.82) !important;
  }

  .portal-topbar-actions {
    width: auto;
    margin-left: auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  body[data-page="portal"].portal-logged-in .portal-notification-toggle,
  body[data-page="portal"].portal-logged-in .personal-progress-toggle,
  body[data-page="portal"].portal-logged-in .submission-heatmap-toggle {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(17, 17, 17, 0.08);
    box-shadow: 0 8px 18px rgba(17, 17, 17, 0.08);
  }

  body[data-page="portal"].portal-logged-in .portal-notification-toggle::before,
  body[data-page="portal"].portal-logged-in .submission-heatmap-icon,
  body[data-page="portal"].portal-logged-in .personal-progress-icon {
    color: #b51f3b;
    background: rgba(181, 31, 59, 0.12);
  }

  body.theme-dark[data-page="portal"].portal-logged-in .portal-notification-toggle,
  body.theme-dark[data-page="portal"].portal-logged-in .personal-progress-toggle,
  body.theme-dark[data-page="portal"].portal-logged-in .submission-heatmap-toggle {
    background: rgba(24, 24, 27, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  }

  .portal-topbar-actions > * {
    animation: topbar-widget-pop 420ms ease-out both;
  }

  .personal-progress-panel,
  .submission-heatmap-panel {
    width: calc(100vw - 16px) !important;
    max-width: none !important;
    left: 8px !important;
    right: 8px !important;
    box-sizing: border-box;
    animation: topbar-widget-rise 260ms ease-out;
  }

  .portal-topbar-actions > * {
    flex: 0 0 auto;
  }
}

@keyframes mobile-topbar-enter {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes topbar-widget-pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes topbar-widget-rise {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 768px) {
  body[data-page="portal"].portal-logged-in .portal-topbar {
    align-items: flex-start;
    gap: 8px;
    padding: 12px 12px 10px;
  }

  .portal-topbar-ghost {
    flex: 1 1 auto;
    width: auto;
    max-width: calc(100vw - 112px);
    min-width: 0;
  }

  .portal-topbar-ghost .ghost-stack {
    width: 100%;
  }

  .portal-topbar-ghost .ghost-primary {
    font-size: 0.74rem !important;
    line-height: 1.05 !important;
    letter-spacing: 0.04em !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word;
    max-width: 100%;
  }

  .portal-topbar-ghost .ghost-secondary {
    font-size: 0.66rem !important;
    line-height: 1.08 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word;
    max-width: 100%;
  }

  .portal-topbar-ghost .ghost-greeting-prefix,
  .portal-topbar-ghost .ghost-greeting-suffix {
    color: inherit;
    font-size: 0.96em;
  }

  .portal-topbar-ghost .ghost-greeting-name {
    color: var(--maroon) !important;
    font-size: 1.08em;
    line-height: 1;
  }

  .portal-topbar-actions {
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
  }

  .submission-heatmap-toggle {
    min-width: 112px;
    max-width: 144px;
    padding: 6px 8px;
    gap: 6px;
  }

  .submission-heatmap-copy strong,
  .personal-progress-summary-card strong {
    font-size: 0.9rem;
  }

  .submission-heatmap-copy span {
    font-size: 0.56rem;
    letter-spacing: 0.08em;
  }

  .submission-heatmap-toggle-copy {
    display: none;
  }

  .personal-progress-toggle,
  .portal-notification-toggle {
    width: 32px;
    height: 32px;
  }

  .submission-heatmap-icon,
  .personal-progress-icon {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }

  .personal-progress-toggle {
    border-radius: 50%;
  }

  .personal-progress-badge {
    min-width: 18px;
    height: 18px;
    top: -7px;
    right: -7px;
    font-size: 0.58rem;
  }

  .personal-progress-panel,
  .submission-heatmap-panel {
    position: fixed;
    top: 84px;
    left: 8px !important;
    right: 8px !important;
    width: calc(100vw - 16px) !important;
    max-width: none !important;
    max-height: calc(100vh - 102px);
    overflow: auto;
    box-sizing: border-box;
  }

  .submission-heatmap-month-strip {
    gap: 10px;
  }

  .submission-heatmap-month-grid {
    grid-auto-columns: 9px;
    grid-template-rows: repeat(7, 9px);
    gap: 3px;
  }

  .submission-heatmap-cell {
    width: 9px;
    height: 9px;
  }
}

/* Final mobile safety override: keep the top widgets fully inside the viewport */
body.mobile-view[data-page="portal"].portal-logged-in .personal-progress-panel,
body.mobile-view[data-page="portal"].portal-logged-in .submission-heatmap-panel {
  position: fixed !important;
  inset: 76px 8px auto 8px !important;
  width: auto !important;
  max-width: none !important;
  transform: none !important;
  box-sizing: border-box;
  overflow: auto;
}

body.mobile-view[data-page="portal"].portal-logged-in .personal-progress-panel {
  padding: 12px;
}

body.mobile-view[data-page="portal"].portal-logged-in .personal-progress-head {
  flex-wrap: wrap;
}

body.mobile-view[data-page="portal"].portal-logged-in .personal-progress-summary {
  grid-template-columns: 1fr;
}

body.mobile-view[data-page="portal"].portal-logged-in .personal-progress-bar-copy {
  flex-wrap: wrap;
}

body.mobile-view[data-page="portal"].portal-logged-in .submission-heatmap-panel {
  padding: 10px;
}

body.mobile-view[data-page="portal"].portal-logged-in .submission-heatmap-months {
  width: 100%;
  overflow-x: auto;
}

body.mobile-view[data-page="portal"].portal-logged-in .submission-heatmap-month-strip {
  width: max-content;
  min-width: 100%;
}

body.mobile-view[data-page="portal"].portal-logged-in .submission-heatmap-toggle {
  width: auto;
  min-width: 0;
  max-width: none;
}

/* Mobile viewport guard: top widgets and DAR content must never exceed screen width. */
@media (max-width: 768px) {
  html,
  body[data-page="portal"],
  body[data-page="portal"] .shell,
  body[data-page="portal"].portal-logged-in .portal-outer {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-ghost {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-actions {
    display: flex;
    flex-wrap: nowrap;
    max-width: 132px;
    min-width: 0;
    gap: 6px;
  }

  body[data-page="portal"].portal-logged-in .portal-topbar-actions > .personal-progress,
  body[data-page="portal"].portal-logged-in .portal-topbar-actions > .submission-heatmap {
    animation: none !important;
    transform: none !important;
  }

  body[data-page="portal"].portal-logged-in .personal-progress-dropdown,
  body[data-page="portal"].portal-logged-in .submission-heatmap-dropdown {
    animation: none !important;
    transform: none !important;
  }

  body[data-page="portal"].portal-logged-in .personal-progress-panel,
  body[data-page="portal"].portal-logged-in .submission-heatmap-panel {
    position: fixed !important;
    top: 76px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 92px);
    box-sizing: border-box;
    overflow: auto !important;
    transform: none !important;
    z-index: 120 !important;
  }

  body[data-page="portal"].portal-logged-in .submission-heatmap-month-strip {
    display: flex;
    width: max-content;
    min-width: 100%;
    max-width: none;
    gap: 10px;
  }

  body[data-page="portal"].portal-logged-in .submission-heatmap-panel {
    overscroll-behavior: contain;
  }

  body[data-page="portal"].portal-logged-in .portal-layout,
  body[data-page="portal"].portal-logged-in .content-stack,
  body[data-page="portal"].portal-logged-in .panel,
  body[data-page="portal"].portal-logged-in .dar-workspace,
  body[data-page="portal"].portal-logged-in .dar-form-panel,
  body[data-page="portal"].portal-logged-in .increment-box,
  body[data-page="portal"].portal-logged-in .form-grid,
  body[data-page="portal"].portal-logged-in .track-switcher {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body[data-page="portal"].portal-logged-in .portal-layout {
    padding-inline: 10px;
  }

  body[data-page="portal"].portal-logged-in .dar-workspace,
  body[data-page="portal"].portal-logged-in .dar-form-panel {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body[data-page="portal"].portal-logged-in .panel-header {
    min-width: 0;
    gap: 10px;
  }

  body[data-page="portal"].portal-logged-in #darSection .panel-header h2,
  body[data-page="portal"].portal-logged-in #pointIndicator {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  body[data-page="portal"].portal-logged-in #darSection > .panel-header h2 {
    font-size: clamp(1.45rem, 8vw, 2rem);
    line-height: 1.08;
  }

  body[data-page="portal"].portal-logged-in #pointIndicator {
    font-size: clamp(1.8rem, 9vw, 2.35rem);
    line-height: 1.05;
  }

  body[data-page="portal"].portal-logged-in .track-switcher {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="portal"].portal-logged-in .track-switcher .compact-button {
    width: 100%;
    min-width: 0;
    padding-inline: 10px;
    white-space: normal;
  }

  body[data-page="portal"].portal-logged-in input,
  body[data-page="portal"].portal-logged-in select,
  body[data-page="portal"].portal-logged-in textarea {
    max-width: 100%;
    box-sizing: border-box;
  }
}

