/**
 * SERA iTop Enhancement — custom.css
 *
 * Loaded on two surfaces:
 *   • Login page    — via SeraLoginExtension (LoginBlockExtension → css block)
 *   • Backoffice    — via SeraBrandingStylesheet (iBackofficeLinkedStylesheetsExtension)
 *
 * Theme classes (login page only):
 *   body.theme-modern  — split-screen branded layout (default)
 *   body.theme-legacy  — original iTop look (background image)
 *
 * Classes are injected by theme-init.html.twig via the `script` block.
 * Backoffice pages never receive a theme class; their rules are always active.
 *
 * Asset paths (relative to this CSS file):
 *   ../images/itop-logo.png        — full/horizontal logo
 *   ../images/itop-logo-square.png — compact square/icon logo
 *   ../images/background.png       — login background (legacy mode)
 *
 * DO NOT modify any iTop core file to apply branding.
 */

/* =========================================================================
   THEME SWITCH ROOT
   =========================================================================
   Minimal root declarations; detailed styles are in each theme section.
   ========================================================================= */

body.theme-modern {
  background: #f0f4f8;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

body.theme-legacy {
  /* Inherits iTop defaults; background set on #login-body below */
}

/* =========================================================================
   MODERN LOGIN
   Layout: fixed left panel (branding) + scrollable right panel (form)

   HTML structure (base.html.twig + login.html.twig):
     <body class="theme-modern">
       <div id="login-body">
         <div id="login-header">    ← hidden in modern mode
         <div id="login-logo">      ← left panel (position: fixed)
           <a href="..."><img ...>
           <div class="sera-branding-panel">  ← injected by theme-init.js
         </div>
         <div id="login-content">   ← right panel (margin-left: 42%)
           <div id="login-title">   ← heading above the card
           <div id="login-form">    ← white card
         </div>
         <div id="login-additional-content">  ← hidden in modern mode
         <div id="login-footer">    ← version badge, pinned bottom-left
       </div>
     </body>
   ========================================================================= */

/* --- Elements hidden in modern layout --- */
body.theme-modern #login-header,
body.theme-modern #login-additional-content {
  display: none !important;
}

/* --- Main container: full-width flex row --- */
body.theme-modern #login-body {
  width: 100vw !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh !important;
  height: 100vh !important;
  display: flex !important;
  flex-direction: row !important;
  position: relative !important;
  overflow: hidden !important;
  background: #f0f4f8 !important;
}

/* --- Left panel: flex column, navy gradient --- */
body.theme-modern #login-logo {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 42% !important;
  min-width: 42% !important;
  height: 100vh !important;
  margin: 0 !important;
  background: linear-gradient(
    160deg,
    #002b5c 0%,
    #003b7e 45%,
    #0055b3 100%
  ) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  padding: 48px 40px !important;
  box-sizing: border-box !important;
  z-index: 10 !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
}

/* Override the <a> wrapper inside #login-logo */
body.theme-modern #login-logo > a {
  display: block;
  margin-bottom: 24px;
  line-height: 0;
}

/* Logo image — replace with SERA asset, displayed on dark background */
body.theme-modern #login-logo img {
  content: url("../images/itop-logo-external.png");
  max-height: 72px;
  max-width: 200px;
  width: auto;
  height: auto;
  display: block;
}

/* --- Right panel: flex grow, light background --- */
body.theme-modern #login-content {
  flex: 1 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 48px 40px !important;
  box-sizing: border-box !important;
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  z-index: 5 !important;
  background: #f0f4f8 !important;
  text-align: left !important;
  /* Strip legacy login.css card wrapper — only #login-form is the white card */
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Shared column width for title + form (login, forgot password, change password) */
body.theme-modern #login-content > #login-title,
body.theme-modern #login-content > #login-form {
  width: 100% !important;
  max-width: 400px !important;
  align-self: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

/* Title above the form card — centered to match footer/links inside the card */
body.theme-modern #login-title {
  margin: 0 0 16px 0 !important;
  padding: 0 !important;
  text-align: center !important;
}

body.theme-modern #login-title h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1a2740;
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: break-word;
}

body.theme-modern #login-title p {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 8px 0;
  line-height: 1.5;
  overflow-wrap: break-word;
}

body.theme-modern #login-title p:last-child {
  margin-bottom: 0;
}

/* White form card — see FORM IMPROVEMENTS section below for full rule */

/* Version badge: pinned to bottom of left panel */
body.theme-modern #login-footer {
  position: fixed !important;
  bottom: 24px !important;
  left: 0 !important;
  width: 42% !important;
  text-align: center !important;
  z-index: 20 !important;
}

/* =========================================================================
   BRANDING PANEL  (injected by theme-init.html.twig into #login-logo)
   ========================================================================= */

.sera-branding-panel {
  text-align: center;
}

.sera-branding-title {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sera-branding-subtitle {
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.sera-support-hours {
  display: inline-block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  padding: 4px 14px;
  margin: 0;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

/* =========================================================================
   FORM IMPROVEMENTS  (modern theme)
   ========================================================================= */

/* Form card */
body.theme-modern #login-form {
  background: #ffffff !important;
  border-radius: 14px !important;
  box-shadow:
    0 2px 24px rgba(0, 43, 92, 0.1),
    0 1px 4px rgba(0, 0, 0, 0.05) !important;
  padding: 36px 32px 28px !important;
  width: 100% !important;
  max-width: 400px !important;
  box-sizing: border-box !important;
}

/* Zero-out ALL left/right offsets from iTop's 70%/margin-left rule on every
   container inside the form — must be !important to beat login.css specificity */
body.theme-modern #login-form-content,
body.theme-modern #login-form-content > div,
body.theme-modern #login-sso-buttons,
body.theme-modern #login-input,
body.theme-modern #login-input > div,
body.theme-modern #login-additional-controls,
body.theme-modern #login-additional-controls > div,
body.theme-modern #login-submit,
body.theme-modern #login-submit > div,
body.theme-modern #login-links,
body.theme-modern #login-form-footer {
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

/* Spacing between field rows */
body.theme-modern #login-input > div {
  margin-bottom: 16px !important;
  margin-top: 0 !important;
  text-align: left !important;
}

/* Labels */
body.theme-modern #login-form label {
  display: block !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #374151 !important;
  margin-bottom: 6px !important;
  letter-spacing: 0.01em !important;
}

/* Inputs — height: 52px to match button, full width, no left offset */
body.theme-modern #login-form input[type="text"],
body.theme-modern #login-form input[type="email"],
body.theme-modern #login-form input[type="password"],
body.theme-modern #login-form input.ibo-input {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 52px !important;
  box-sizing: border-box !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 8px !important;
  padding: 0 16px !important;
  font-size: 15px !important;
  color: #1a2740 !important;
  background: #f9fafb !important;
  outline: none !important;
  margin: 0 !important;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
  -webkit-appearance: none !important;
  appearance: none !important;
}

body.theme-modern #login-form input[type="text"]:focus,
body.theme-modern #login-form input[type="email"]:focus,
body.theme-modern #login-form input[type="password"]:focus,
body.theme-modern #login-form input.ibo-input:focus {
  border-color: #003b7e !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 59, 126, 0.12) !important;
}

/* Submit button — same 52px height as inputs */
body.theme-modern #login-submit {
  margin-top: 10px !important;
}

body.theme-modern #login-submit > div {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

body.theme-modern #login-submit input[type="submit"],
body.theme-modern #login-submit button[type="submit"] {
  display: block !important;
  width: 100% !important;
  height: 52px !important;
  box-sizing: border-box !important;
  padding: 0 24px !important;
  background: linear-gradient(90deg, #002b5c 0%, #0055b3 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  letter-spacing: 0.02em !important;
  margin: 0 !important;
  transition:
    box-shadow 0.2s ease,
    opacity 0.2s ease !important;
}

body.theme-modern #login-submit input[type="submit"]:hover,
body.theme-modern #login-submit button[type="submit"]:hover {
  box-shadow: 0 4px 18px rgba(0, 59, 126, 0.38) !important;
  opacity: 0.92 !important;
}

/* Secondary actions (Cancel, etc.) — outline style, visually subordinate to primary */
body.theme-modern #login-submit input.login-submit-secondary,
body.theme-modern #login-submit input[type="button"] {
  display: block !important;
  width: 100% !important;
  height: 52px !important;
  box-sizing: border-box !important;
  padding: 0 24px !important;
  background: #ffffff !important;
  color: #003b7e !important;
  border: 1.5px solid #d1d5db !important;
  border-radius: 8px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  letter-spacing: 0.02em !important;
  margin: 0 !important;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease !important;
}

body.theme-modern #login-submit input.login-submit-secondary:hover,
body.theme-modern #login-submit input[type="button"]:hover {
  background: #f9fafb !important;
  border-color: #003b7e !important;
  color: #002b5c !important;
}

body.theme-modern #login-submit input.login-submit-secondary:focus-visible,
body.theme-modern #login-submit input[type="button"]:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(0, 59, 126, 0.12) !important;
}

/* Forgot-password link */
body.theme-modern #login-links {
  margin-top: 16px !important;
  text-align: center !important;
}

body.theme-modern #login-links a,
body.theme-modern #login-form-footer a {
  color: #003b7e !important;
  font-size: 13px !important;
  text-decoration: none !important;
}

body.theme-modern #login-links a:hover,
body.theme-modern #login-form-footer a:hover {
  text-decoration: underline !important;
}

/* "iTop Powered by Combodo" */
body.theme-modern #login-form-footer {
  margin-top: 12px !important;
  text-align: center !important;
  font-size: 12px !important;
  color: #9ca3af !important;
}

/* =========================================================================
   RESPONSIVE  (modern theme collapses to stacked on small screens)
   ========================================================================= */

@media (max-width: 768px) {
  body.theme-modern {
    background: linear-gradient(180deg, #003b7e 0%, #0055b3 100%);
  }

  body.theme-modern #login-body::after {
    display: none;
  }

  body.theme-modern #login-body {
    flex-direction: column !important;
    height: auto !important;
  }

  body.theme-modern #login-logo {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 200px !important;
    padding: 32px 24px 20px !important;
  }

  body.theme-modern #login-content {
    flex: none !important;
    width: 100% !important;
    min-height: unset !important;
    padding: 16px 20px 32px !important;
  }

  body.theme-modern #login-footer {
    position: static !important;
    width: 100% !important;
    padding-bottom: 16px !important;
  }
}

/* =========================================================================
   LEGACY LOGIN
   All rules scoped to body.theme-legacy — acts as a safe fallback.
   ========================================================================= */

body.theme-legacy #login-body {
  background-image: url("../images/background.png");
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
}

body.theme-legacy #login-logo img,
body.theme-legacy img[src*="itop-logo-external"] {
  content: url("../images/itop-logo-external.png");
  max-height: 94px;
  width: auto;
}

/* Login logo — modern theme */
body.theme-modern #login-logo img,
img[src*="itop-logo-external"] {
  content: url("../images/itop-logo-external.png");
  max-height: 94px;
  width: auto;
}

/* =========================================================================
   VERSION BADGE  (both themes)
   ========================================================================= */

.sera-login-version {
  text-align: center;
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.04em;
  user-select: none;
}

/* Ensure legibility on any dark/image background */
#login-body .sera-login-version {
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Slightly smaller in the modern left-panel footer */
body.theme-modern #login-footer .sera-login-version {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}

/* =========================================================================
   LOGO OVERRIDE  (backoffice — always active, no theme class required)
   =========================================================================
   Rules use both structural BEM selectors and src-based attribute selectors
   as a fallback for iTop version upgrades that may change CSS class names.

   Selectors from spec:
     .header_logo img          — classic backoffice top bar
     .ibo-top-bar-logo img     — iTop 3.x top bar
     .brand-logo img           — portal / white-label pages
     img[src*="itop-logo"]     — attribute fallback (all remaining placements)
   ========================================================================= */

/* Square / compact logo (collapsed sidebar) */
.ibo-navigation-menu--square-company-logo > img,
img[src*="itop-logo-square"] {
  content: url("../images/itop-logo-square.png");
  object-fit: contain;
  width: 38px;
  height: 38px;
}

/* Full / horizontal logo (expanded sidebar) */
.ibo-navigation-menu--full-company-logo > img,
img[src*="itop-logo.png"] {
  content: url("../images/itop-logo.png");
  object-fit: contain;
  max-width: 180px;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* Top bar and portal */
.header_logo img,
.ibo-top-bar-logo img,
.brand-logo img {
  content: url("../images/itop-logo.png");
  max-height: 48px;
  width: auto;
  object-fit: contain;
}

/* Unauthenticated / error pages */
#uwp-logo {
  content: url("../images/itop-logo.png");
  max-height: 48px;
  width: auto;
}

/* Broad attribute fallback: catches any remaining iTop logo placements */
img[src*="itop-logo"][src$=".png"]:not([src*="square"]) {
  content: url("../images/itop-logo.png");
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* Portal logo: override logo-itop-dark-bg.svg with SERA version from extension assets
   (more resilient than replacing core file — survives iTop upgrades/reinstalls) */
img[src*="logo-itop-dark-bg"],
img[src*="dark-bg"] {
  content: url("../images/logo-itop-dark-bg.svg");
  max-height: 48px;
  width: auto;
  object-fit: contain;
}

/* =========================================================================
   THEME COMPATIBILITY  (backoffice — dark themes, accessibility)
   ========================================================================= */

/* Remove tint that some themes add on the logo anchor */
.ibo-navigation-menu--square-company-logo,
.ibo-navigation-menu--full-company-logo {
  background-color: transparent !important;
}

/* Allow taller logos without clipping in the nav header area */
[data-role="ibo-navigation-menu"] .ibo-navigation-menu--top-part {
  height: auto;
  min-height: 80px;
}

/* =========================================================================
   PORTAL HOME — 40% left stack / 60% Kresna panel (desktop)
   Left: Search → New request → Ongoing → FAQ → Approvals (vertical).
   Right: Kresna iframe (position:absolute, out of document flow).
   ========================================================================= */

body.home .tiles_wrapper.row,
body.home .sera-portal-layout {
  display: block !important;
  position: relative;
  margin-left: 0;
  margin-right: 0;
}

body.home .tiles_wrapper > [class*="col-"] {
  flex: none !important;
  float: none !important;
  padding-left: 0;
  padding-right: 0;
}

body.home .tiles_wrapper > .col-xs-12:has(#brick-search-within-tickets-for-portal-user),
body.home .tiles_wrapper > .col-xs-12:has(#brick-services),
body.home .tiles_wrapper > .col-xs-12:has(#brick-ongoing-tickets-for-portal-user),
body.home .tiles_wrapper > .col-xs-12:has(#brick-approvals),
body.home .tiles_wrapper > .col-xs-12:has(#brick-faq) {
  min-width: 0;
}

/* Shared card styling for left-column portal tiles */
body.home .tiles_wrapper .tile:not(#brick-sera-kresna-assistant) {
  border-radius: 15px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  background: #fff;
  height: auto;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

body.home .tiles_wrapper .tile:not(#brick-sera-kresna-assistant):hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

body.home #brick-search-within-tickets-for-portal-user.sera-search-card,
body.home #brick-search-within-tickets-for-portal-user {
  border-radius: 15px;
}

/* Desktop: 40% kiri stack lurus, 60% kanan Kresna */
@media (min-width: 961px) {
  body.home .tiles_wrapper.row,
  body.home .sera-portal-layout {
    padding-right: calc(60% + 16px);
    min-height: calc(100vh - 70px);
  }

  /* Kolom kiri — full width area, stack vertikal */
  body.home .tiles_wrapper > .col-xs-12:has(#brick-search-within-tickets-for-portal-user),
  body.home .tiles_wrapper > .col-xs-12:has(#brick-services),
  body.home .tiles_wrapper > .col-xs-12:has(#brick-ongoing-tickets-for-portal-user),
  body.home .tiles_wrapper > .col-xs-12:has(#brick-faq),
  body.home .tiles_wrapper > .col-xs-12:has(#brick-approvals) {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 14px 0 !important;
    padding: 0 !important;
  }

  body.home .tiles_wrapper > .col-xs-12:has(#brick-approvals):last-child,
  body.home .tiles_wrapper > .col-xs-12:has(#brick-faq):last-of-type {
    margin-bottom: 0 !important;
  }

  /* Kresna — keluar dari flow, nempel kanan 60% */
  body.home .tiles_wrapper > .col-xs-12:has(#brick-sera-kresna-assistant) {
    position: absolute;
    top: 0;
    right: 0;
    width: 60% !important;
    max-width: 60% !important;
    height: calc(100vh - 70px);
    max-height: calc(100vh - 70px);
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.home .tiles_wrapper .tile:not(#brick-sera-kresna-assistant) {
    width: 100%;
    height: auto;
    margin-bottom: 0 !important;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
  }

  /* Readable tile size — aksesibilitas (target pengguna lanjut usia) */
  body.home a.tile#brick-services,
  body.home a.tile#brick-ongoing-tickets-for-portal-user,
  body.home a.tile#brick-faq,
  body.home a.tile#brick-approvals {
    padding: 32px 32px 28px !important;
    min-height: 8.5em !important;
  }

  body.home a.tile#brick-services .tile_decoration,
  body.home a.tile#brick-ongoing-tickets-for-portal-user .tile_decoration,
  body.home a.tile#brick-faq .tile_decoration,
  body.home a.tile#brick-approvals .tile_decoration {
    top: 1em !important;
    margin: 0 28px 14px 0 !important;
  }

  body.home a.tile#brick-services .tile_decoration > span.icon,
  body.home a.tile#brick-ongoing-tickets-for-portal-user .tile_decoration > span.icon,
  body.home a.tile#brick-faq .tile_decoration > span.icon,
  body.home a.tile#brick-approvals .tile_decoration > span.icon {
    font-size: 2.75rem !important;
  }

  body.home a.tile#brick-services .tile_body,
  body.home a.tile#brick-ongoing-tickets-for-portal-user .tile_body,
  body.home a.tile#brick-faq .tile_body,
  body.home a.tile#brick-approvals .tile_body {
    padding-left: 4.3em !important;
    line-height: 1.6 !important;
  }

  body.home a.tile#brick-services .tile_title,
  body.home a.tile#brick-ongoing-tickets-for-portal-user .tile_title,
  body.home a.tile#brick-faq .tile_title,
  body.home a.tile#brick-approvals .tile_title {
    font-size: 1.2rem !important;
    margin-bottom: 0.75rem !important;
  }

  body.home a.tile#brick-services .tile_description,
  body.home a.tile#brick-ongoing-tickets-for-portal-user .tile_description,
  body.home a.tile#brick-faq .tile_description,
  body.home a.tile#brick-approvals .tile_description {
    font-size: 1.125rem !important;
    line-height: 1.6 !important;
    display: block !important;
    overflow: visible;
  }

  body.home .tile.tile-filter-brick#brick-search-within-tickets-for-portal-user {
    padding: 36px 32px 30px !important;
    min-height: auto !important;
  }

  body.home .tile.tile-filter-brick#brick-search-within-tickets-for-portal-user .tile_decoration {
    top: 1em !important;
    margin: 0 28px 14px 0 !important;
  }

  body.home .tile.tile-filter-brick#brick-search-within-tickets-for-portal-user .tile_decoration > span.icon {
    font-size: 2.75rem !important;
  }

  body.home .tile.tile-filter-brick#brick-search-within-tickets-for-portal-user .tile_body {
    padding-left: 4.3em !important;
    line-height: 1.6 !important;
  }

  body.home .tile.tile-filter-brick#brick-search-within-tickets-for-portal-user .tile_title {
    font-size: 1.2rem !important;
    margin-bottom: 0.75rem !important;
  }

  body.home .tile.tile-filter-brick#brick-search-within-tickets-for-portal-user .tile_description {
    font-size: 1.125rem !important;
    line-height: 1.6 !important;
    margin-bottom: 0.85rem;
  }

  body.home .tile.tile-filter-brick#brick-search-within-tickets-for-portal-user .tile_filterbox input[type="text"],
  body.home .tile.tile-filter-brick#brick-search-within-tickets-for-portal-user .tile_filterbox button[type="submit"] {
    font-size: 1.05rem !important;
    min-height: 2.75rem;
  }
}

/* Mobile: satu kolom, Kresna di atas */
@media (max-width: 960px) {
  body.home .tiles_wrapper.row,
  body.home .sera-portal-layout {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    padding-right: 0;
    min-height: 0;
  }

  body.home .tiles_wrapper > .col-xs-12:has(#brick-sera-kresna-assistant) {
    position: static;
    width: 100% !important;
    max-width: 100% !important;
    order: 1;
  }

  body.home .tiles_wrapper > .col-xs-12:has(#brick-search-within-tickets-for-portal-user) {
    order: 2;
  }

  body.home .tiles_wrapper > .col-xs-12:has(#brick-services) {
    order: 3;
  }

  body.home .tiles_wrapper > .col-xs-12:has(#brick-ongoing-tickets-for-portal-user) {
    order: 4;
  }

  body.home .tiles_wrapper > .col-xs-12:has(#brick-faq) {
    order: 5;
  }

  body.home .tiles_wrapper > .col-xs-12:has(#brick-approvals) {
    order: 6;
  }
}

/* Kresna FilterBrick — full height flex chain: tile → body → description → panel */
body.home #brick-sera-kresna-assistant.tile,
body.home .tile.tile-filter-brick#brick-sera-kresna-assistant,
body.home #brick-sera-kresna-assistant .tile_body,
body.home #brick-sera-kresna-assistant .tile_description,
body.home .sera-kresna-panel {
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

@media (max-width: 960px) {
  body.home .tiles_wrapper > .col-xs-12:has(#brick-sera-kresna-assistant),
  body.home #brick-sera-kresna-assistant.tile,
  body.home .tile.tile-filter-brick#brick-sera-kresna-assistant,
  body.home #brick-sera-kresna-assistant .tile_body,
  body.home #brick-sera-kresna-assistant .tile_description,
  body.home .sera-kresna-panel {
    height: calc(100vh - 70px);
    max-height: calc(100vh - 70px);
    min-height: calc(100vh - 70px);
  }
}

body.home #brick-sera-kresna-assistant.tile,
body.home .tile.tile-filter-brick#brick-sera-kresna-assistant {
  padding: 0 !important;
  margin-bottom: 0 !important;
  line-height: normal !important;
  border: none;
  box-shadow: none;
  background: transparent;
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
  pointer-events: auto;
}

body.home #brick-sera-kresna-assistant .tile_decoration,
body.home #brick-sera-kresna-assistant > .tile_body > .tile_title,
body.home #brick-sera-kresna-assistant .tile_filterbox {
  display: none !important;
}

body.home #brick-sera-kresna-assistant .tile_body {
  padding: 0 !important;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

body.home #brick-sera-kresna-assistant .tile_description {
  display: flex !important;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.home .sera-kresna-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 16px;
  border: 2px solid #93c5fd;
  box-shadow: 0 12px 32px rgba(30, 64, 175, 0.18);
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 28%);
  overflow: hidden;
}

body.home .sera-kresna-frame-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #f8fafc;
  overflow: hidden;
}

body.home .sera-kresna-frame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  border-radius: 0;
  display: block;
  background: #fff;
}
