:root {
  --rib-navy-950: #020d23;
  --rib-navy-900: #051a42;
  --rib-navy-800: #0d2b5e;
  --rib-blue-700: #2e5090;
  --rib-gold-300: #eedebb;
  --rib-gold-500: #c5a880;
  --rib-ivory: #fdfcf8;
  --rib-border: #e3e8ef;
  --md-sys-color-primary: #051a42;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eedebb;
  --md-sys-color-on-primary-container: #051a42;
  --md-sys-color-secondary: #866d4b;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-background: #f6f7f9;
  --md-sys-color-surface-container: #f3f5f8;
  --md-sys-color-outline: #c8d0dc;
  --mat-app-background-color: #f6f7f9;
  --mat-progress-spinner-active-indicator-color: #051a42;
  --mat-form-field-filled-focus-active-indicator-color: #051a42;
  --mat-form-field-filled-focus-label-text-color: #051a42;
  --mat-form-field-outlined-focus-outline-color: #051a42;
  --mat-form-field-outlined-focus-label-text-color: #051a42;
  --mat-checkbox-selected-icon-color: #c5a880;
  --mat-slide-toggle-selected-handle-color: #051a42;
  --mat-slide-toggle-selected-track-color: #2e5090;
}

html,
body {
  font-family: "Poppins", Arial, sans-serif !important;
  background: #f6f7f9 !important;
}

mifosx-login .login-wrapper {
  background: #f6f7f9 !important;
}

mifosx-login .hero-panel {
  background:
    linear-gradient(135deg, rgba(2, 13, 35, 0.96), rgba(5, 26, 66, 0.88)),
    url("ribk-assets/royal-pattern.svg") center / cover no-repeat !important;
}

mifosx-login .hero-panel .hero-overlay {
  background:
    radial-gradient(circle at 75% 20%, rgba(91, 135, 217, 0.22), transparent 34%),
    linear-gradient(180deg, transparent 45%, rgba(2, 13, 35, 0.4)) !important;
}

mifosx-login .hero-panel::after {
  content: "";
  position: absolute;
  right: -150px;
  bottom: -170px;
  width: 560px;
  height: 560px;
  border: 1px solid rgba(238, 222, 187, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(238, 222, 187, 0.035), 0 0 0 140px rgba(238, 222, 187, 0.025);
  pointer-events: none;
}

mifosx-login .hero-panel .hero-content {
  align-items: flex-start !important;
  justify-content: flex-end !important;
  padding: clamp(3rem, 6vw, 6rem) !important;
}

mifosx-login .hero-title-minimal {
  max-width: 760px;
  margin: 0 !important;
  color: #ffffff !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-size: 0 !important;
  font-weight: 400 !important;
  line-height: 1.05 !important;
  letter-spacing: -0.035em !important;
}

mifosx-login .hero-title-minimal::before {
  content: "ROYAL INVESTMENT BANK";
  display: block;
  margin-bottom: 1rem;
  color: #eedebb;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

mifosx-login .hero-title-minimal::after {
  content: "Secure staff banking operations.";
  display: block;
  max-width: 720px;
  color: #ffffff;
  font-size: clamp(3rem, 5vw, 5.6rem);
}

mifosx-login .login-panel {
  background: linear-gradient(145deg, #ffffff 0%, #fdfcf8 100%) !important;
}

mifosx-login .login-header {
  padding: 1.5rem 1.75rem !important;
}

mifosx-login .login-card-container {
  max-width: 500px !important;
  padding: 1.5rem !important;
}

mifosx-login .login-card {
  border: 1px solid rgba(5, 26, 66, 0.1) !important;
  border-radius: 24px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 28px 80px rgba(2, 13, 35, 0.14) !important;
}

mifosx-login .logo-section {
  padding: 2.3rem 2.25rem 1.75rem !important;
  border-bottom: 1px solid rgba(5, 26, 66, 0.08) !important;
}

mifosx-login .logo-image {
  width: min(100%, 310px) !important;
  max-height: 110px !important;
  object-fit: contain !important;
  content: url("ribk-assets/rib-logo-gold.svg") !important;
}

mifosx-login .form-section {
  padding: 2rem 2.25rem 2.3rem !important;
}

mifosx-login .mat-mdc-text-field-wrapper {
  border-radius: 12px 12px 0 0 !important;
  background: #f4f6f9 !important;
}

mifosx-login .mdc-line-ripple::after {
  border-bottom-color: #051a42 !important;
}

mifosx-login .login-submit-button md-filled-button,
mifosx-login .login-submit-button button,
mifosx-login .login-submit-button .mdc-button {
  min-height: 50px !important;
  border-radius: 10px !important;
  color: #ffffff !important;
  background: #051a42 !important;
  box-shadow: 0 12px 28px rgba(5, 26, 66, 0.18) !important;
}

mifosx-login .login-submit-button md-filled-button:hover,
mifosx-login .login-submit-button button:hover,
mifosx-login .login-submit-button .mdc-button:hover {
  background: #0d2b5e !important;
}

mifosx-login .resources-section,
mifosx-login .resources-branding,
mifosx-login .resources-links {
  display: none !important;
}

mifosx-login .login-footer {
  opacity: 0.45;
}

mifosx-navbar mat-toolbar,
mifosx-navbar .mat-toolbar,
mat-toolbar.primary,
.mat-toolbar.mat-primary {
  color: #ffffff !important;
  background: #051a42 !important;
}

mifosx-navigation mat-sidenav,
mifosx-navigation .mat-drawer,
.mat-drawer.mat-drawer-side {
  border-right-color: rgba(5, 26, 66, 0.08) !important;
  background: #ffffff !important;
}

.mat-mdc-raised-button.mat-primary,
.mat-mdc-unelevated-button.mat-primary,
button.mat-primary {
  --mdc-filled-button-container-color: #051a42;
  --mdc-protected-button-container-color: #051a42;
}

.mat-mdc-tab .mdc-tab-indicator__content--underline {
  border-color: #c5a880 !important;
}

.mat-mdc-progress-spinner circle,
.mat-spinner circle {
  stroke: #051a42 !important;
}

@media (max-width: 959px) {
  mifosx-login .login-card-container {
    max-width: 540px !important;
  }
}

/* RIBK staff application — full interior treatment */
body:not(:has(mifosx-login)) {
  background:
    radial-gradient(circle at 100% 0%, rgba(197, 168, 128, 0.10), transparent 28rem),
    #f5f7fa !important;
}

body:not(:has(mifosx-login)) .mat-drawer-content,
body:not(:has(mifosx-login)) main,
body:not(:has(mifosx-login)) .content,
body:not(:has(mifosx-login)) .container-fluid {
  background: transparent !important;
}

body:not(:has(mifosx-login)) mat-card,
body:not(:has(mifosx-login)) .mat-mdc-card,
body:not(:has(mifosx-login)) .mat-card,
body:not(:has(mifosx-login)) .card {
  border: 1px solid rgba(5, 26, 66, 0.09) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0 12px 34px rgba(5, 26, 66, 0.07) !important;
}

body:not(:has(mifosx-login)) h1,
body:not(:has(mifosx-login)) h2,
body:not(:has(mifosx-login)) h3,
body:not(:has(mifosx-login)) .mat-mdc-card-title,
body:not(:has(mifosx-login)) .mat-card-title {
  color: #051a42 !important;
  font-family: Georgia, "Times New Roman", serif !important;
  letter-spacing: -0.018em;
}

body:not(:has(mifosx-login)) table,
body:not(:has(mifosx-login)) .mat-mdc-table,
body:not(:has(mifosx-login)) .mat-table {
  overflow: hidden;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
  background: #ffffff !important;
}

body:not(:has(mifosx-login)) .mat-mdc-header-row,
body:not(:has(mifosx-login)) .mat-header-row,
body:not(:has(mifosx-login)) thead tr {
  background: #051a42 !important;
}

body:not(:has(mifosx-login)) .mat-mdc-header-cell,
body:not(:has(mifosx-login)) .mat-header-cell,
body:not(:has(mifosx-login)) thead th {
  color: #ffffff !important;
  font-weight: 600 !important;
  letter-spacing: 0.025em;
}

body:not(:has(mifosx-login)) .mat-mdc-row:hover,
body:not(:has(mifosx-login)) .mat-row:hover,
body:not(:has(mifosx-login)) tbody tr:hover {
  background: #fdf9f1 !important;
}

body:not(:has(mifosx-login)) .mat-mdc-form-field,
body:not(:has(mifosx-login)) .mat-form-field {
  --mdc-outlined-text-field-focus-outline-color: #051a42;
  --mdc-outlined-text-field-focus-label-text-color: #051a42;
}

body:not(:has(mifosx-login)) .mat-mdc-raised-button.mat-primary,
body:not(:has(mifosx-login)) .mat-mdc-unelevated-button.mat-primary,
body:not(:has(mifosx-login)) button.mat-primary {
  border-radius: 9px !important;
  color: #ffffff !important;
  background: #051a42 !important;
  box-shadow: 0 8px 18px rgba(5, 26, 66, 0.16) !important;
}

#ribk-interior-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 280px;
  margin-right: 0.85rem;
  color: #ffffff;
  text-decoration: none;
}

#ribk-interior-brand > img {
  width: 31px;
  height: 31px;
  object-fit: contain;
}

#ribk-interior-brand span {
  display: grid;
  line-height: 1.08;
}

#ribk-interior-brand b {
  color: #eedebb;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

#ribk-interior-brand small {
  margin-top: 0.23rem;
  color: rgba(255,255,255,0.72);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
}

#ribk-environment-badge {
  position: fixed;
  z-index: 9997;
  right: 18px;
  top: 72px;
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.52rem 0.75rem;
  border: 1px solid rgba(197, 168, 128, 0.48);
  border-radius: 999px;
  color: #44351f;
  background: rgba(253, 252, 248, 0.96);
  box-shadow: 0 8px 28px rgba(5, 26, 66, 0.10);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

#ribk-environment-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c58b2a;
  box-shadow: 0 0 0 4px rgba(197, 139, 42, 0.14);
}

#ribk-operations-launcher {
  position: fixed;
  z-index: 9998;
  right: 18px;
  bottom: 18px;
  font-family: "Poppins", Arial, sans-serif;
}

#ribk-operations-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  min-height: 48px;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(238, 222, 187, 0.28);
  border-radius: 12px;
  color: #ffffff;
  background: #051a42;
  box-shadow: 0 16px 38px rgba(2, 13, 35, 0.24);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
}

#ribk-operations-toggle img {
  width: 24px;
  height: 24px;
}

#ribk-operations-panel {
  position: absolute;
  right: 0;
  bottom: 60px;
  width: min(390px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid rgba(5, 26, 66, 0.12);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(2, 13, 35, 0.24);
}

#ribk-operations-panel[hidden] { display: none; }

#ribk-operations-panel header {
  padding: 1.25rem 1.3rem 1rem;
  background:
    linear-gradient(135deg, rgba(2, 13, 35, 0.98), rgba(5, 26, 66, 0.94)),
    url("ribk-assets/royal-pattern.svg") center / cover;
}

#ribk-operations-panel header img {
  width: 238px;
  max-width: 82%;
  height: 54px;
  object-fit: contain;
  object-position: left center;
}

#ribk-operations-panel header p {
  margin: 0.55rem 0 0;
  color: rgba(255,255,255,0.68);
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#ribk-operations-panel nav { padding: 0.55rem; }

#ribk-operations-panel nav a {
  display: grid;
  gap: 0.12rem;
  padding: 0.78rem 0.85rem;
  border-radius: 10px;
  color: #051a42;
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease;
}

#ribk-operations-panel nav a:hover {
  background: #f6f1e8;
  transform: translateX(2px);
}

#ribk-operations-panel nav strong { font-size: 0.78rem; }
#ribk-operations-panel nav small { color: #68778b; font-size: 0.67rem; }

#ribk-operations-panel footer {
  padding: 0.72rem 1.3rem;
  border-top: 1px solid #eceff3;
  color: #768397;
  background: #fafbfc;
  font-size: 0.62rem;
}

.ribk-replaced-logo {
  width: min(260px, 100%) !important;
  height: auto !important;
  object-fit: contain !important;
}

@media (max-width: 760px) {
  #ribk-environment-badge { top: 62px; right: 10px; }
  #ribk-operations-launcher { right: 10px; bottom: 10px; }
  #ribk-operations-toggle span { display: none; }
  #ribk-operations-toggle { width: 50px; padding: 0; justify-content: center; }
  #ribk-interior-brand { min-width: 0; }
  #ribk-interior-brand span { display: none; }
}

#ribk-client-user-link {
  position: fixed;
  z-index: 9995;
  top: 122px;
  right: 18px;
  width: min(330px, calc(100vw - 36px));
  padding: 17px 18px;
  border: 1px solid rgba(5, 26, 66, 0.12);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 46px rgba(2, 13, 35, 0.16);
  font-family: "Poppins", Arial, sans-serif;
}

#ribk-client-user-link small,
#ribk-client-user-link strong { display: block; }
#ribk-client-user-link small { color: #96703b; font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
#ribk-client-user-link strong { margin-top: 4px; color: #051a42; font-family: Georgia, "Times New Roman", serif; font-size: 20px; }
#ribk-client-user-link p { margin: 8px 0 13px; color: #68778b; font-size: 12px; line-height: 1.5; }
#ribk-client-user-link a { display: block; padding: 10px 12px; border-radius: 9px; color: #fff; background: #051a42; text-align: center; text-decoration: none; font-size: 12px; font-weight: 700; }
#ribk-client-user-link a:hover { background: #0b2b63; }

@media (max-width: 760px) {
  #ribk-client-user-link { top: 105px; right: 10px; width: min(310px, calc(100vw - 20px)); }
}
