/* Base */
:root{
  color-scheme: only light;
  --brand-green: #009840; /* brand green from the logo */
  --soft-red-bg:     #fff6f7;
  --soft-red-border: #f3c4ca;
  --soft-red-fg:     #9f2d3c;
  --brand-amber:#f59e0b;          /* warn */
  --fab-size: 56px;      /* button diameter */
  --fab-gap:  22px;      /* margin from screen edges */
  --fab-glyph: 24px;     /* plus icon size */
}
*,*::before,*::after{ box-sizing: border-box; }
body{
  margin:0;
  font-family: "Plus Jakarta Sans", ui-sans-serif, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:#f5f7fa;
  color:#111;
  line-height:1.45;
}

/* ===== Container ===== */
.container{ width:92%; max-width:1180px; margin:32px auto; background:#fff; padding:20px 18px 56px; border-radius:12px; box-shadow:0 8px 28px rgba(0,0,0,.06); position:relative; }
.page-grid{ display:grid; gap:18px; }
#mainCol{ min-width:0; }
@media (min-width:1024px){
  .page-grid{ grid-template-columns:minmax(0,1fr) 340px; align-items:start; }
  #dashboardSection{ position:sticky; top:16px; height:fit-content; }
}

/* ===== Brand / logout ===== */
.brandbar { display:flex; justify-content:center; align-items:center; margin: 8px 0 0; }
#brand img {
  max-width: 60vw;   /* up to 60% of viewport width */
  min-width: 320px;  /* don’t go too small */
  height: auto;
  display: block;
  margin: 0 auto 2rem;
}
.logout-top{
  position:absolute; right: 10px; top: 10px;
  background:#fff5f5; color:#a13333; border:1.5px solid #ffdede;
  width:38px; height:38px; border-radius:9999px; display:grid; place-items:center;
}
.logout-top:hover{ background:#ffecec; }

/* ===== Login panel ===== */
.login-panel{ display:grid; place-items:center; text-align:center; min-height:58vh; gap:8px; padding:16px 0 32px; }
.login-panel .title{ margin:8px 0 4px; letter-spacing:-.02em; }
.login-actions{ margin-top:8px; }

/* ===== Inputs ===== */
input[type="text"],input[type="email"],input[type="date"],input[type="file"],input:not([type]){ width:100%; padding:10px 12px; border:1px solid #c9c9c9; border-radius:8px; background:#fff; color:#111; }
#searchInput{ border:1.5px solid #e6e1ff; border-radius:9999px; padding:14px 18px; font-size:16px; margin:10px 0 12px; box-shadow:inset 0 1px 2px rgba(0,0,0,.03); }
#searchInput:focus{ outline:none; box-shadow:0 0 0 3px rgba(97, 244, 89, 0.18); border-color:#fff34e; }

/* ===== List / accordion ===== */
#listKerjaSama{ list-style:none; padding:0; margin:0; }
#listKerjaSama li{ margin-bottom:15px; padding:12px 0; border-bottom:1px dashed #ece9ff; }
details>summary{ cursor:pointer; font-weight:700; padding:8px 0; color:#242238; }
.mou-block{ padding:8px 0 6px; border-left:3px solid #f1eefe; margin-left:6px; padding-left:10px; }
#listKerjaSama ul{ list-style:none; padding-left:12px; margin:6px 0; }
#listKerjaSama ul li{ padding:3px 0; }

/* ===== Dashboard ===== */
.card{ background:#fff; border:1.5px solid #f1eefe; border-radius:16px; padding:14px; box-shadow:0 1px 8px rgba(59,47,163,.05); margin-bottom:12px; }
.kpi{ font-size:22px; font-weight:800; letter-spacing:-.02em; color:#2f237b; }
.kpi-label{ font-size:12.5px; color:#6b6690; }
.table-lite{ width:100%; border-collapse:collapse; margin-top:8px; }
.table-lite th,.table-lite td{ padding:8px 10px; border-bottom:1px solid #eee; text-align:left; }
.table-lite th{ color:#3b2fa3; font-weight:700; background:#f8f7ff; }
.acc-summary{ display:flex; align-items:center; justify-content:space-between; padding:6px 0; font-weight:700; color:#2a2756; }
.badge{ display:inline-block; min-width:22px; padding:2px 8px; text-align:center; border-radius:9999px; background:#efe9ff; color:#2f237b; font-weight:700; font-size:12px; }

/* ===== Audit log controls (kept) ===== */
.log-controls{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
  align-items:center;
}
@media (min-width:640px){
  .log-controls{ grid-template-columns: 1fr 1fr auto auto; }
}
.log-controls .btn{ width:100%; }

/* ===== Buttons ===== */
.btn{ appearance:none; background:#fff; color:#3b2fa3; border:1.5px solid #e6e1ff; border-radius:9999px; padding:10px 16px; font-weight:600; line-height:1.2; cursor:pointer; box-shadow:0 1px 2px rgba(59,47,163,.06); transition:.18s; }
.btn:hover{ background:#f5f3ff; border-color:#ddd6ff; box-shadow:0 4px 12px rgba(59,47,163,.12); }
.btn:active{ transform:translateY(1px); }
.btn-refresh{ background:#f3fff5; border-color:#bdf2c6; color:#237a39; }
.btn-refresh:hover{ background:#e9ffec; }
.btn-export{ background:#fffdf2; border-color:#fde9b6; color:#7a5d16; }
.btn-export:hover{ background:#fff7e0; }

/* Logout button – compact circle vs X */
.btn.logout-top{
  /* tweak these to taste */
  --size: 28px;                     /* circle diameter */
  --x-len: calc(var(--size) * .50); /* X length relative to circle */
  --x-stroke: 2.2px;                /* X thickness */

  position:absolute; right:10px; top:10px;
  width:var(--size); height:var(--size);
  padding:0; border-radius:9999px;
  background:#fff6f7;               /* soft pastel red */
  border:1px solid #f3c4ca;
  box-shadow:0 6px 14px rgba(239,67,111,.10),
             inset 0 1px 0 rgba(255,255,255,.9);

  /* hide any text glyph; we draw the X with CSS */
  color:transparent; font-size:0; line-height:0;
}
.btn.logout-top:hover{ background:#ffecee; border-color:#efb8c1; }
.btn.logout-top:active{ transform:translateY(1px); }
.btn.logout-top:focus-visible{ outline:3px solid rgba(239,71,111,.25); outline-offset:2px; }

/* Centered X */
.btn.logout-top::before,
.btn.logout-top::after{
  content:"";
  position:absolute; left:50%; top:50%;
  width:var(--x-len); height:var(--x-stroke);
  background:#ef476f; border-radius:1px;
  transform-origin:center;
}
.btn.logout-top::before{ transform:translate(-50%,-50%) rotate(45deg); }
.btn.logout-top::after { transform:translate(-50%,-50%) rotate(-45deg); }

/* ===== FAB ===== */
.fab{
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + var(--fab-gap));
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--fab-gap));
  z-index: 9999;
}

/* Main button */
.fab__btn{
  display: grid; place-items: center; cursor: pointer;
  width: var(--fab-size); height: var(--fab-size);
  border-radius: 9999px;
  background: #fff; color:#4B2BA6;
  border: 1.5px solid #e6e1ff;
  box-shadow:
    0 12px 28px rgba(59,47,163,.18),
    inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .16s ease, box-shadow .16s ease;

  /* keep the text from scaling weirdly on iOS */
  -webkit-text-size-adjust:none;
  text-size-adjust:none;
  font-size: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.fab__btn:hover{ box-shadow: 0 16px 32px rgba(59,47,163,.20), inset 0 1px 0 rgba(255,255,255,.9); }
.fab__btn:active{ transform: translateY(1px); }

.fab__glyph{
  display:block;
  width: var(--fab-glyph);
  height: var(--fab-glyph);
  transform: translateY(-1px) rotate(0deg);
}
.fab__btn[aria-expanded="true"] .fab__glyph{
  transform: translateY(-1px) rotate(45deg);
}

/* menu pops just above the 56px button */
.fab__menu{
  position: absolute;
  right: 10px;
  bottom: calc(var(--fab-size) + 8px);
  display:flex; flex-direction:column; gap:10px;
  pointer-events:none; opacity:0; transform:translateY(6px); transition:.16s;
}
.fab__menu.is-open{ pointer-events:auto; opacity:1; transform:translateY(0); }
.fab__item{ display:inline-flex; align-items:center; gap:10px; cursor:pointer; height:48px; min-width:200px; padding:0 16px; white-space:nowrap; border-radius:9999px; border:1.5px solid #e6e1ff; background:#fff; color:#3b2fa3; font-weight:700; box-shadow:0 8px 22px rgba(59,47,163,.14); }
.fab__icon{ display:inline-grid; place-items:center; width:22px; height:22px; border-radius:9999px; border:1.5px solid #e6e1ff; font-weight:900; line-height:1; }

/* ===== Alpha filter ===== */
.alpha-filter{ display:flex; gap:10px; align-items:center; overflow-x:auto; -webkit-overflow-scrolling:touch; padding:2px 0 8px; margin:6px 0 8px; border-bottom:1px dashed #e9e6ff; scrollbar-width:thin; }
.alpha-filter::-webkit-scrollbar{ height:6px; }
.alpha-filter::-webkit-scrollbar-thumb{ background:rgba(59,47,163,.15); border-radius:4px; }
.alpha-chip{ all:unset; cursor:pointer; color:#3b2fa3; font-size:12px; font-weight:400; letter-spacing:.01em; line-height:1; padding-bottom:2px; border-bottom:2px solid transparent; }
.alpha-chip:hover{ color:#2f237b; border-bottom-color:#e6e1ff; }
.alpha-chip.is-active{ color:#2f237b; border-bottom-color:#cfc7ff; }

/* ===== Modal ===== */
#modal{ position:fixed; inset:0; z-index:10000; display:none; }
.md-backdrop{ position:fixed; inset:0; background:rgba(0,0,0,.35); display:grid; place-items:start center; overflow:auto; padding:24px 12px; }
.md-card{ background:#fff; width:min(760px,92vw); max-height:calc(100vh - 64px); border-radius:16px; box-shadow:0 12px 34px rgba(0,0,0,.18); position:relative; overflow:auto; padding:18px 16px 16px; }
.md-close{ position:absolute; top:10px; right:10px; width:40px; height:40px; border-radius:9999px; border:1.5px solid #ffdede; background:#fff5f5; color:#a13333; display:grid; place-items:center; }
.md-close span{ transform:translateY(-1px); font-weight:700; }
.md-body{ margin-top:8px; }

/* Remove the top-right X inside modals */
.md-close{ display:none !important; }

/* ===== Modern forms ===== */
.form-modern .fm-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media (max-width:680px){ .form-modern .fm-grid{ grid-template-columns:1fr; } }
.form-modern .fm-field{ display:flex; flex-direction:column; gap:6px; }
.form-modern .fm-field > span{ font-size:13px; color:#5a5a6e; font-weight:600; }
.form-modern .fm-field input,
.form-modern .fm-field select {
  border:1.5px solid #e6e1ff; border-radius:10px; padding:10px 12px; outline:none;
}
.form-modern .fm-field input:focus,
.form-modern .fm-field select:focus { box-shadow:0 0 0 3px rgba(93,80,217,.18); }
.form-modern .fm-actions{ display:flex; gap:10px; margin-top:10px; }

/* ===== Toast ===== */
#toast{ position:fixed; left:50%; bottom:20px; transform:translateX(-50%); background:#111; color:#fff; padding:10px 14px; border-radius:12px; display:none; box-shadow:0 8px 20px rgba(0,0,0,.25); z-index:10001; }
#toast.is-show{ display:block; }

/* ===== Heading alignment ===== */
#listTitle{ text-align:center; font-weight:800; color:#1c2a5d; }
@media (min-width:1024px){ #listTitle{ text-align:left; } }

/* ===== Hide list while loading ===== */
#listKerjaSama[data-locked="1"] > li { display:none !important; }
#listKerjaSama[data-locked="1"] > li[data-loading] { display:list-item !important; }

/* ===== App vs Login visibility (single source of truth) ===== */
body[data-state="login"] #loginSection{ display:grid; }
body[data-state="login"] #mainCol,
body[data-state="login"] #dashboardSection,
body[data-state="login"] #logsSection,
body[data-state="login"] #fabAdmin{ display:none !important; }

body[data-state="app"] #loginSection{ display:none !important; }
body[data-state="app"] #mainCol,
body[data-state="app"] #dashboardSection{ display:block; }

/* Container size tuning for LOGIN only */
body[data-state="login"] .container{
  max-width: 680px;        /* tighter card */
  padding: 24px 22px 40px; /* less empty space */
  margin: 36px auto;       /* centered nicely */
}

/* Login: reduce space between logo and blue heading */
body[data-state="login"] #brand img{
  width: clamp(320px, 50vw, 560px);
  margin-bottom: .75rem;   /* was 2rem */
}

body[data-state="login"] .login-panel{
  padding-top: 4px;        /* was 12px */
}

body[data-state="login"] .login-panel .title{
  margin-top: 0;           /* was 8px */
}

/* Login panel layout: compact */
.login-panel{
  display:grid;
  place-items:center;
  text-align:center;
  min-height: 0;     /* remove tall empty space */
  gap: 10px;
  padding: 12px 0 20px;
}

/* Login title – fix cropped descenders + slightly lighter weight */
.login-panel .title{
  margin: 8px 0 4px;
  font-weight: 700;          /* was 800 */
  line-height: 1.22;         /* was ~1.12 – prevents clipping of “g”, “y”, etc. */
  letter-spacing: -.01em;
  font-size: clamp(22px, 3.4vw, 34px);
  background: linear-gradient(90deg,#2563eb 0%, #6aaaf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 2px;       /* small safety buffer for descenders */
}

/* Subtitle: light gray, smaller */
.login-panel .subtitle{
  margin: 0;
  font-size: clamp(13.5px, 1.6vw, 15px);
  color:#6b7280;
}

/* Only color the domain text */
.login-panel .subtitle strong{
  color: var(--brand-green);
  font-weight: 700;
}

/* Login button: full width, big radius like mobile card */
.login-actions{ margin-top: 10px; width: 100%; }
.login-actions .login-btn{
  width: 100%;
  height: 44px;
  border-radius: 14px;
  font-weight: 700;
  background:#2563eb;
  color:#fff;
  border: none;
  box-shadow: 0 6px 18px rgba(37,99,235,.18);
}
.login-actions .login-btn:hover{ filter: brightness(1.05); }

/* Buttons (global) – inherit font already; keep existing look for the app */
.btn{ font-family: inherit; }

/* Pastel-red cancel */
.form-modern .fm-actions .btn-cancel,
.form-modern .fm-actions .btn + .btn{
  background: var(--soft-red-bg);
  border-color: var(--soft-red-border);
  color: var(--soft-red-fg);
}
.form-modern .fm-actions .btn-cancel:hover,
.form-modern .fm-actions .btn + .btn:hover{
  background:#ffecee;
  border-color:#efb8c1;
}
.form-modern .fm-actions .btn-cancel:active,
.form-modern .fm-actions .btn + .btn:active{
  transform: translateY(1px);
}
.form-modern .fm-actions .btn-cancel:focus-visible,
.form-modern .fm-actions .btn + .btn:focus-visible{
  outline:3px solid rgba(239,71,111,.25);
  outline-offset:2px;
}

/* status line shown under each mitra (always visible) */
.mitra-status{
  margin: 4px 0 6px 0;
  font-family: "Plus Jakarta Sans", ui-sans-serif, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 200;
  font-size: 13.5px;
  letter-spacing: .005em;
  color:#475569;
}
.mitra-status .ok{ color: var(--brand-green); }
.mitra-status .warn{ color: var(--brand-amber); }
.mitra-status .bad{ color: #9f2d3c; }

/* === AUDIT LOG (single set of rules) === */
#logsSection { max-width: 100%; } /* no overflow-x:hidden */
.table-wrap  { width: 100%; overflow: auto; -webkit-overflow-scrolling: touch; }

#tblLogs{
  width: 100%;
  table-layout: fixed;        /* stable column widths, no overlap */
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;           /* horizontal scroll on small screens */
}

#tblLogs th, #tblLogs td{
  padding: 12px 14px;
  vertical-align: top;
}
#tblLogs th{ background:#f8f7ff; color:#3b2fa3; font-weight:700; }

/* add breathing room between columns (esp. Waktu ↔ User) */
#tblLogs th + th,
#tblLogs td + td{ padding-left: 24px; }

/* Column widths */
#tblLogs th:nth-child(1), #tblLogs td:nth-child(1){ width:180px; } /* Waktu  */
#tblLogs th:nth-child(2), #tblLogs td:nth-child(2){ width:260px; } /* User   */
#tblLogs th:nth-child(3), #tblLogs td:nth-child(3){ width:120px; } /* Aksi   */
/* Target column is flexible */

/* keep first 3 columns on one line; clip long User nicely */
#tblLogs td:nth-child(1),
#tblLogs td:nth-child(2),
#tblLogs td:nth-child(3){
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#tblLogs td:nth-child(2){ overflow: hidden; text-overflow: ellipsis; }

/* let Target wrap (file names / partner names) */
#tblLogs td:nth-child(4){
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* large screens can expand freely */
@media (min-width: 1024px){
  #tblLogs{ min-width: 0; }
}

/* small-screen padding tweak (optional) */
@media (max-width: 720px){
  #tblLogs th, #tblLogs td{ padding: 10px 12px; }
}

/* ---- Collapsible Audit Log ---- */
.collapsible .collapsible__body{ margin-top:10px; }

/* Pastel blue button variant (same base .btn) */
.btn-soft-blue{
  background:#f2f7ff;
  border-color:#cfe0ff;
  color:#1e3a8a;
  box-shadow:0 1px 2px rgba(30,58,138,.06);
}
.btn-soft-blue:hover{
  background:#e9f1ff;
  border-color:#bfd4ff;
}
.btn-soft-blue.is-open{
  background:#e3ecff;
  border-color:#b3ccff;
}

/* Caret: right when closed, down when open */
#btnToggleLogs::after{
  content:"▸";                 /* closed = right */
  display:inline-block;
  margin-left:8px;
}
#btnToggleLogs[aria-expanded="true"]::after{
  content:"▾";                 /* open = down */
}

.acc-summary{ display:flex; flex-wrap:wrap; gap:6px; }
.acc-summary > span:first-child{ flex:1 1 100%; min-width:0; } /* title line wraps */
.acc-summary .badge{ margin-left:auto; } /* keep badge aligned to the right when possible */

/* Show the correct header for each state */
body[data-state="login"]  .brandbar--app   { display: none !important; }
body[data-state="app"]    .brandbar--login { display: none !important; }

/* Login-only brand (outside the container) */
body[data-state="login"] .brandbar--login{
  display:flex;
  justify-content:center;
  align-items:center;
  width: 92%;
  max-width: 1180px;
  margin: 28px auto 10px;       /* top and small bottom gap before the card */
}

/* Bigger logo for login, but not oversized */
body[data-state="login"] .brandbar--login img{
  width: clamp(340px, 52vw, 600px);
  height: auto;
  display: block;
}

/* Tighten spacing between the outside logo and the white card */
body[data-state="login"] .container{
  max-width: 680px;
  padding: 24px 22px 40px;
  margin: 8px auto 36px;        /* smaller top margin so card sits closer to logo */
}

/* KEEP your in-app brand sizing as-is */
#brand img {
  max-width: 60vw;
  min-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto 2rem;
}

/* Optional: small tweaks to heading spacing on login */
body[data-state="login"] .login-panel { padding-top: 4px; }
body[data-state="login"] .login-panel .title { margin-top: 0; }

/* Only show the correct header */
body[data-state="login"]  .brandbar--app   { display: none !important; }
body[data-state="app"]    .brandbar--login { display: none !important; }

/* Login logo: bigger, outside the container */
body[data-state="login"] .brandbar--login {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 92%;
  max-width: 1180px;
  margin: 28px auto 10px; /* space above and below */
}
body[data-state="login"] .brandbar--login img {
  width: clamp(340px, 52vw, 600px);
  height: auto;
  display: block;
}

/* App logo: your current inside-container styling */
body[data-state="app"] #brand img {
  max-width: 60vw;
  min-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto 2rem;
}

/* Main container adjustments */
.container{
  width: min(960px, calc(100% - 24px - env(safe-area-inset-left) - env(safe-area-inset-right))); /* ~12px gutter each side on phones */
  margin: 24px auto 32px;     /* a bit less vertical margin on small screens */
  padding: 32px 28px 40px;
  background:#fff;
  border-radius:20px;
  box-shadow:0 6px 18px rgba(0,0,0,.06);
  position:relative;
  overflow:hidden;
}

/* On smaller screens, keep it fluid */
@media (max-width: 768px){
  .container {
    margin: 20px auto;           /* smaller top/bottom margin for mobile */
    padding: 24px 20px 32px;
  }
}

/* Login logo bar matches the container width */
.brandbar--login {
  width: 100%;
  max-width: 680px;
  margin: 28px auto 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

/* Make sure text/buttons shrink instead of overflowing */
.login-panel .title,
.login-panel .subtitle,
.login-panel button {
  word-wrap: break-word;
  overflow-wrap: anywhere;
  text-align: center;
}

/* In-app logo (inside the white container) — never overflow */
body[data-state="app"] .brandbar--app #brand img{
  width: 100%;          /* let it scale with the card */
  max-width: 560px;     /* pick your preferred cap (e.g., 520–600px) */
  height: auto;
  margin: 0 auto 1.25rem;
}

/* (keep your login logo rules as-is) */
/* Generic fallback — lightweight */
#brand img { max-width: 100%; height: auto; margin: 0 auto 2rem; }

/* ==== Gradient hero cap (green → yellow) on the container ==== */
:root{
  /* tweak height & colors to taste */
  --hero-h: clamp(160px, 24vw, 260px);
  --grad-g1: #009840;   /* brand green */
  --grad-g2: #22c55e;   /* light green */
  --grad-y1: #fde047;   /* bright yellow */
  --grad-y2: #facc15;   /* warm yellow/amber */
}

/* make sure the gradient respects rounded corners */
.container{
  position: relative;
  overflow: hidden;
}

/* Fallback for browsers without color-mix */
@supports not (color-mix(in oklab, #000 50%, #fff 50%)){
  body[data-state="app"] .container::before{
    background:
      radial-gradient(60% 120% at 0% -20%, rgba(0,152,64,.28) 0%, transparent 70%),
      radial-gradient(70% 140% at 100% -30%, rgba(253,224,71,.30) 0%, transparent 72%),
      linear-gradient(180deg, rgba(34,197,94,.22) 0%, rgba(250,204,21,.18) 38%, rgba(255,255,255,0) 85%);
  }
}

/* ensure content sits above the gradient */
.container > *{ position: relative; z-index: 1; }

/* small spacing nudge so logo/text breathe inside the gradient */
body[data-state="app"] .brandbar--app{ margin-top: 4px; }

/* ==== FAB – glossy blue + glow ======================================= */
:root{
  --fab-size: 56px;                 /* keep your size */
  --fab-gap:  22px;                 /* keep your gap */
  --fab-glyph: 28px;                /* slightly bigger plus */

  /* theme colors */
  --fab-blue1: #2563eb;             /* blue-600 */
  --fab-blue2: #4f46e5;             /* indigo-600 */
  --fab-cyan:  #06b6d4;             /* cyan-500 */
  --fab-glow1: rgba(37,99,235,.45); /* outer glow */
  --fab-glow2: rgba(99,102,241,.35);
}

/* container position (unchanged) */
.fab{
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + var(--fab-gap));
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--fab-gap));
  z-index: 9999;
}

/* main button: gradient, glossy, white plus */
.fab__btn{
  position: relative;
  display: grid; place-items: center;
  width: var(--fab-size); height: var(--fab-size);
  border-radius: 9999px;
  border: 0;
  color: #fff;                                  /* plus icon (currentColor) */
  background:
    linear-gradient(135deg, var(--fab-blue1) 0%, var(--fab-blue2) 55%, var(--fab-cyan) 100%);
  box-shadow:
    0 14px 34px rgba(37,99,235,.35),
    0 4px 10px rgba(37,99,235,.25),
    inset 0 1px 0 rgba(255,255,255,.35);        /* subtle inner highlight */
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: visible;                             /* for the glow aura */
}

/* tasteful animated glow aura */
.fab__btn::after{
  content:"";
  position:absolute; left:50%; top:50%;
  width: 160%; height:160%;
  transform: translate(-50%,-50%) scale(.92);
  border-radius: 9999px;
  pointer-events:none;
  background:
    radial-gradient(60% 60% at 50% 50%, var(--fab-glow2) 0%, rgba(0,0,0,0) 70%),
    radial-gradient(100% 100% at 50% 50%, var(--fab-glow1) 0%, rgba(0,0,0,0) 80%);
  filter: blur(8px);
  opacity:.75;
  animation: fabAura 2.4s ease-in-out infinite;
}

@keyframes fabAura{
  0%,100%{ transform: translate(-50%,-50%) scale(.92); opacity:.65; }
  50%    { transform: translate(-50%,-50%) scale(1.03); opacity:.9; }
}

/* motion-friendly */
@media (prefers-reduced-motion: reduce){
  .fab__btn::after{ animation: none; opacity:.7; }
}

/* hover/active/focus */
.fab__btn:hover{
  box-shadow:
    0 18px 40px rgba(37,99,235,.45),
    0 6px 14px rgba(37,99,235,.28),
    inset 0 1px 0 rgba(255,255,255,.4);
  transform: translateY(-1px);
  filter: saturate(1.05);
}
.fab__btn:active{ transform: translateY(0); }

.fab__btn:focus-visible{
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255,255,255,.95) inset,
    0 0 0 4px rgba(147,197,253,.65),           /* blue focus ring */
    0 18px 40px rgba(37,99,235,.45);
}

/* menu-open state – keep it bright */
.fab__btn[aria-expanded="true"]{
  filter: brightness(1.05) saturate(1.06);
}

/* plus icon size + subtle depth */
.fab__glyph{
  width: var(--fab-glyph);
  height: var(--fab-glyph);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.25));
  transform: translateY(-1px) rotate(0deg);
}
.fab__btn[aria-expanded="true"] .fab__glyph{
  transform: translateY(-1px) rotate(45deg);
}

/* menu chips keep existing style; add slight tint on hover */
.fab__item:hover{ background: #f6f7ff; }

/* === FAB – subtle glow (override) =================================== */
.fab__btn{
  /* softer shadows */
  box-shadow:
    0 10px 22px rgba(37,99,235,.20),
    0 3px 10px rgba(37,99,235,.15),
    inset 0 1px 0 rgba(255,255,255,.35);
}

/* smaller, faint aura; no animation */
.fab__btn::after{
  content:"";
  position:absolute; left:50%; top:50%;
  width:120%; height:120%;
  transform:translate(-50%,-50%);
  border-radius:9999px;
  pointer-events:none;
  background:
    radial-gradient(60% 60% at 50% 50%, rgba(99,102,241,.12) 0%, rgba(0,0,0,0) 70%),
    radial-gradient(90% 90%  at 50% 50%, rgba(37,99,235,.12) 0%, rgba(0,0,0,0) 80%);
  filter: blur(5px);
  opacity:.26;                   /* dial this between .15–.30 to taste */
}

/* hover: just a tiny lift */
.fab__btn:hover{
  box-shadow:
    0 12px 26px rgba(37,99,235,.24),
    0 5px 12px rgba(37,99,235,.18),
    inset 0 1px 0 rgba(255,255,255,.38);
  transform: translateY(-1px);
}

/* --- Logout button: tighter to the corner on small screens --- */
.container{ position:relative; }               /* anchor for absolute pos */
.brandbar--app{ position:relative; }

/* Phones / narrow view */
@media (max-width: 560px){
  /* shrink & nudge further into the corner */
  .btn.logout-top{
    --size: 26px;                              /* smaller circle */
    top: calc(env(safe-area-inset-top, 0px) + 4px);
    right: calc(env(safe-area-inset-right, 0px) + 4px);
    border-width: 1px;
    box-shadow: 0 2px 8px rgba(239,71,111,.16);
  }

  /* reserve space so the centered logo never sits behind the X */
  .brandbar--app{
    padding-right: 44px;                       /* ≈ button size + gap */
  }

  /* optional: cap the logo width a bit more on very small screens */
  body[data-state="app"] #brand img{
    max-width: 82vw;
  }
}

/* Anchor the logout button to the container's top-right corner */
.container{ position: relative; }                     /* positioning context */

/* Make sure the brand header isn't the context */
.brandbar--app{
  display:grid;
  place-items:center;
  position:relative;
  padding-right:0 !important;
}

.container{
  --pad-x: 28px;   /* matches your current right/left padding */
  --pad-y: 32px;   /* matches your current top padding */
  padding: var(--pad-y) var(--pad-x) 40px;
}

/* Mobile padding values */
@media (max-width:768px){
  .container{ --pad-x: 20px; --pad-y: 24px; }
}

/* 2) Hug the top-right corner of the container’s *border*, not the padding */
.btn.logout-top{
  position:absolute;
  top:  calc(6px - var(--pad-y));
  right: calc(6px - var(--pad-x));
  /* keep the rest of your styles (size, colors, etc.) */
}

/* Safe-area friendly (iPhone notch) */
@supports (inset: auto){
  .btn.logout-top{
    top:  calc(max(6px, env(safe-area-inset-top))  - var(--pad-y));
    right: calc(max(6px, env(safe-area-inset-right)) - var(--pad-x));
  }
}

/* ===== Login page: floating card + page gradient ===== */

/* Full-height green→yellow gradient for the entire login page */
html, body { min-height: 100%; }

body[data-state="login"]{
  background: linear-gradient(180deg, #e6f6e8 0%, #fff3c9 100%) fixed;
  background-repeat: no-repeat;
}


/* Keep a visible gap from the viewport edges on ALL widths */
body[data-state="login"] .container,
body[data-state="login"] .brandbar--login{
  width: min(680px, 100% - 32px);   /* 16px padding on left+right */
  margin-left: auto;
  margin-right: auto;
}

/* Card look for the login container */
body[data-state="login"] .container{
  margin-top: 12px;
  margin-bottom: 36px;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0,0,0,.08);
  background: #ffffff;                 /* keep the card itself white */
  padding: 24px 22px 20px;          /* your existing spacing */
}

/* Optional: tiny screens get a touch more breathing room */
@media (max-width: 360px){
  body[data-state="login"] .container,
  body[data-state="login"] .brandbar--login{
    width: min(680px, 100% - 24px); /* 12px per side on very small phones */
  }
}

/* Let the in-app logo blend with the header gradient */
.container > .brandbar--app{ z-index: 0; }      /* or: z-index:auto */
.brandbar--app{ position: relative; }           /* keep your layout */
.brandbar--app #brand img{ mix-blend-mode: multiply; }

/* Make whites blend away (temporary) */
.brandbar--login img,
.brandbar--app  #brand img{
  mix-blend-mode: multiply;
}

/* Card stays white; cap is drawn by ::before only */
body[data-state="app"] .container{
  background:#f9f9f9 !important;
  position:relative;
  overflow:hidden;
  isolation:isolate; /* safe for blend-mode */
}

/* Short header gradient cap (ends before the heading) */
@media (max-width:640px){ :root{ --hero-h:320px; } }

body[data-state="app"] .container::before{
  content:"";
  position:absolute;
  left:0; right:0; top:0;
  height:var(--hero-h);
  z-index:1;                    /* above white card */
  pointer-events:none;

  /* gradient mix */
  background:
    radial-gradient(60% 120% at 0% -20%, rgba(0,152,64,.28) 0%, transparent 70%),
    radial-gradient(70% 140% at 100% -30%, rgba(253,224,71,.30) 0%, transparent 72%),
    linear-gradient(180deg, rgba(34,197,94,.22) 0%, rgba(250,204,21,.18) 38%, rgba(255,255,255,0) 85%);

  /* fade out last ~18% so it stops before the heading */
  -webkit-mask-image: linear-gradient(to bottom,
      rgba(0,0,0,1) 0%, rgba(0,0,0,1) 82%, rgba(0,0,0,0) 100%);
          mask-image: linear-gradient(to bottom,
      rgba(0,0,0,1) 0%, rgba(0,0,0,1) 82%, rgba(0,0,0,0) 100%);
}

/* Ensure content sits above the cap */
body[data-state="app"] .container > *{
  position:relative;
  z-index:2;
}

/* === "MoU kedaluwarsa ≤ 90 hari" summary bar — flat + subtle outer lift === */

/* Base: clean, flat card-like chip */
#mouSoonAcc > summary.acc-summary{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  cursor: pointer;
  margin: 0 0 8px 0;
  padding: 12px 14px;
  border-radius: 12px;

  background: #fffde4c0;                          /* no gradient */
  border: 1px solid rgba(0,152,64,.22);      /* soft green edge */
  box-shadow: 0 1px 2px rgba(0,0,0,.04);     /* tiny depth */

  transition: box-shadow .15s ease,
              transform  .12s ease,
              border-color .15s ease;
  overflow: hidden;                           /* safety */
  isolation: isolate;
}

/* Hover / keyboard focus: gentle lift + on-brand outer glow */
#mouSoonAcc > summary.acc-summary:hover,
#mouSoonAcc > summary.acc-summary:focus-visible{
  transform: translateY(-1px);
  border-color: rgba(0,152,64,.32);
  box-shadow:
    0 2px 6px rgba(0,0,0,.05),
    0 10px 24px rgba(0,152,64,.12),  /* greenish glow */
    0 6px 18px rgba(253,224,71,.10); /* warm yellow tint */
}

/* Keep a mild highlight while open */
#mouSoonAcc[open] > summary.acc-summary{
  box-shadow:
    0 2px 8px rgba(0,0,0,.05),
    0 8px 20px rgba(0,152,64,.10);
}

/* Active press */
#mouSoonAcc > summary.acc-summary:active{
  transform: translateY(0);
  box-shadow:
    0 2px 8px rgba(0,0,0,.06),
    0 6px 14px rgba(0,152,64,.10);
}

/* Accessible focus ring */
#mouSoonAcc > summary.acc-summary:focus-visible{
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255,255,255,.9) inset,
    0 0 0 4px rgba(250,204,21,.30),
    0 10px 24px rgba(0,152,64,.12);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  #mouSoonAcc > summary.acc-summary{ transition: none; }
}

/* clickable row; hide default marker */
details.card summary.acc-summary{
  cursor:pointer;
  list-style:none;
  display:flex;
  align-items:center;
  gap:10px;
}
details.card summary.acc-summary::-webkit-details-marker{ display:none; }

/* caret that rotates */
details.card summary.acc-summary::after{
  content:"▼";
  margin-left:8px;
  transform: rotate(-90deg);
  transition: transform .16s ease;
}
details.card[open] summary.acc-summary::after{ transform: rotate(0deg); }

/* optional: small fade when opening */
details.card[open] .acc-body{ animation: dOpen .15s ease; }
@keyframes dOpen{ from{
  opacity:0; 
  transform:translateY(-4px);} to{
    opacity:1; 
    transform:none;} 
}

/* Compact KPI row */
.kpi-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* always 3 across */
  gap: 10px;
  margin-bottom: 10px;
}

/* Smaller, tighter KPI tiles */
.card--kpi{
  padding: 10px 12px;              /* tighter */
  text-align: center;
  border-radius: 12px;              /* a bit smaller than big cards */
}

.card--kpi .kpi{
  font-size: 22px;                  /* you already use this; keep it bold/clear */
  line-height: 1;
}
.card--kpi .kpi-label{
  font-size: 12.5px;
  color: #6b6690;
}

/* If the sidebar is very narrow, let them breathe a bit */
@media (max-width: 360px){
  .kpi-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* === Consistent mobile gutters + widths (login & app) ================== */
:root{
  --gutter: 16px;           /* default phone side-gap */
  --container-max: 960px;   /* app card max width */
  --login-max: 680px;       /* login card max width */
}
@media (min-width:768px){ :root{ --gutter: 20px; } }
@media (min-width:1024px){ :root{ --gutter: 24px; } }

/* App card (inside the app) */
.container{
  width: min(var(--container-max), calc(100% - var(--gutter)*2));
  margin: 24px auto 32px;
  padding: 32px var(--gutter) 40px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  position: relative;
  overflow: hidden;
}

/* Login: logo-row and card share the SAME width & side-gap */
body[data-state="login"] .brandbar--login,
body[data-state="login"] .container{
  width: min(var(--login-max), calc(100% - var(--gutter)*2));
  margin-left: auto;
  margin-right: auto;
}
body[data-state="login"] .brandbar--login{ margin: 24px auto 10px; }

/* Logo sizing – never overflow, nicely centered */
body[data-state="login"] .brandbar--login img{
  width: min(560px, 100%);
  height: auto;
}
body[data-state="app"] .brandbar--app #brand img{
  width: min(560px, calc(100% - 64px)); /* reserve space from logout X */
  max-width: 100%;
  height: auto;
  margin: 0 auto 1rem;
}

/* Shorter, subtle header cap inside app (optional tweak) */
@media (max-width:640px){ :root{ --hero-h: 220px; } }

/* Logout button: always hug the card’s top-right corner (safe-area aware) */
.btn.logout-top{
  position: absolute;
  top:  calc(max(10px, env(safe-area-inset-top))   - 0px);
  right: calc(max(10px, env(safe-area-inset-right)) - 0px);
  /* other visual styles already defined */
}

/* KPI row: keep compact on phones */
.kpi-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width:360px){
  .kpi-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* === Perfectly center the logo (login + app) ========================= */

/* Center the header row itself */
.brandbar--login,
.brandbar--app{
  display: grid;
  place-items: center;
}

/* Login header should match the card width and be centered */
:root{
  --gutter: 16px;
  --login-max: 680px;
}
@media (min-width:768px){ :root{ --gutter: 20px; } }

body[data-state="login"] .brandbar--login{
  width: min(var(--login-max), calc(100% - var(--gutter)*2));
  margin-inline: auto;
}

/* Make the image self-centering and never overflow */
.brandbar--login img,
.brandbar--app  #brand img{
  display: block;
  max-width: min(560px, 100%);
  height: auto;
  margin-inline: auto;      /* guarantees perfect centering */
}

/* Kill any padding that would visually push the center */
@media (max-width:560px){
  .brandbar--app{ padding-right: 0 !important; }
}

/* The logout button is absolutely positioned, so it won't affect centering */
.btn.logout-top{ position:absolute; right:10px; top:10px; }

/* --- Logout button: always hug the card's top-right corner --- */
:root{ --corner-gap: 8px; }        /* tweak to 6px/10px to taste */

/* The card is the anchor */
.container{ position: relative; }

/* Do NOT let the header become the containing block */
.brandbar--app{ position: static !important; }  /* keep your grid centering */

/* Pin the X to the container corner */
.btn.logout-top{
  position: absolute !important;
  z-index: 10;
  top:  calc(env(safe-area-inset-top, 0px)  + var(--corner-gap));
  right: calc(env(safe-area-inset-right, 0px) + var(--corner-gap));
  margin: 0;
}

/* Small phones: slightly smaller circle */
@media (max-width: 560px){
  .btn.logout-top{ --size: 26px; }
}

/* Nested TL + Program look */
.section-heading{ font-weight:800; color:#2563eb; margin:4px 0 6px; }
.fup-list{ list-style:none; margin:8px 0 0; padding-left:0; }
.fup-item{ margin:6px 0 10px; }

details.fup-details > summary{
  font-weight:700; color:#2a2756; padding:6px 0;
}
.fup-body{
  margin:6px 0 0 6px;
  padding:8px 10px;
  border-left:3px solid #eef;
  background:#fafaff;
  border-radius:6px;
}
.fup-meta .muted{ color:#6b6690; margin-bottom:4px; }
.program-list{ list-style:none; margin:8px 0 0; padding-left:12px; }
.program-heading{ margin:2px 0 4px; }
.no-programs{ color:#7a7a9a; font-style:italic; margin-top:6px; }
.mt-4{ margin-top:6px; }

/* prevent long text in inputs from expanding the modal horizontally */
.form-modern .fm-grid,
.form-modern .fm-field { min-width: 0; }
.form-modern .fm-field input,
.form-modern .fm-field select {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ensure modal card never grows beyond viewport width */
.md-card { width: min(760px, 92vw); }

/* if extremely long unbroken strings are typed */
.form-modern .fm-field input { overflow-wrap: anywhere; }

/* Default spacing so it never crashes into buttons */
.support-bar{
  margin: 10px 0 0;      /* clean space above */
  text-align: center;
  font-size: 13.5px;
  color: #475569;
}

/* If you want the in-app one a bit further from content,
   it already gets inline margin-top:14px from JS. */
#supportBarLogin { margin-top: 10px !important; }

.support-bar a{ color:#1d4ed8; text-decoration:none; }
.support-bar a:hover{ text-decoration:underline; }

/* alpha bar layout – wrap, no side-scroll */
#alphaFilter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#alphaFilter .alpha-chip {
  white-space: nowrap;
}

/* collapsed view: hide middle A–Z chips (D..W) */
#alphaFilter[data-expanded="0"] .mid-chip { display: none; }

/* show the … chip only when collapsed */
#alphaFilter[data-expanded="0"] .ellipsis-chip { display: inline-block; }
#alphaFilter[data-expanded="1"] .ellipsis-chip { display: none; }

/* optional: on wide screens show everything by default */
@media (min-width: 768px) {
  #alphaFilter { gap: 8px; }
}

/* stop side-scroll and allow wrapping */
#alphaFilter{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  overflow-x: visible;   /* <-- override the class */
}

/* hide middle letters when collapsed */
#alphaFilter[data-expanded="0"] .mid-chip{ display:none; }

/* show/hide … chip */
#alphaFilter[data-expanded="0"] .ellipsis-chip{ display:inline-block; }
#alphaFilter[data-expanded="1"] .ellipsis-chip{ display:none; }

/* keep chips on one line each */
#alphaFilter .alpha-chip{ white-space:nowrap; }

#alphaFilter .alpha-chip[data-nav]{ font-weight:700; }