/* ==========================================================
   ECCF KYC Form — styles
   ========================================================== */

/* ---------- ECCF brand typography ----------
   English : Causten Font Family   ·   Arabic : Fustat Font Family
     Headline      65pt  ExtraBold (800)
     Sub-Headline  45pt  Bold      (700)
     Body text 1   25pt  Medium    (500)
     Body text 2   15pt  Regular   (400)
   Sa malaking screen, eksakto ang laki (65 / 45 / 25 / 15); sa tablet at phone,
   lumiliit nang proporsyonal (clamp) para magkasya pero pareho ang hierarchy at weights.
   Causten: ilagay ang licensed .woff2 sa assets/fonts/causten/ — habang wala pa,
   ang naka-install na Causten sa computer, saka Fustat, ang ginagamit. */
@font-face { font-family: "Causten"; font-style: normal; font-weight: 400; font-display: swap;
  src: local("Causten Regular"), local("Causten-Regular"), url("../fonts/causten/Causten-Regular.woff2") format("woff2"); }
@font-face { font-family: "Causten"; font-style: normal; font-weight: 500; font-display: swap;
  src: local("Causten Medium"), local("Causten-Medium"), url("../fonts/causten/Causten-Medium.woff2") format("woff2"); }
@font-face { font-family: "Causten"; font-style: normal; font-weight: 600; font-display: swap;
  src: local("Causten SemiBold"), local("Causten-SemiBold"), url("../fonts/causten/Causten-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Causten"; font-style: normal; font-weight: 700; font-display: swap;
  src: local("Causten Bold"), local("Causten-Bold"), url("../fonts/causten/Causten-Bold.woff2") format("woff2"); }
@font-face { font-family: "Causten"; font-style: normal; font-weight: 800; font-display: swap;
  src: local("Causten ExtraBold"), local("Causten-ExtraBold"), url("../fonts/causten/Causten-ExtraBold.woff2") format("woff2"); }

@font-face { font-family: "Fustat"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/fustat/fustat-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Fustat"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/fustat/fustat-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fustat"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/fustat/fustat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Fonts — walang Arabic glyphs ang Causten kaya kusang Fustat ang Arabic text */
  --font: "Causten", "Fustat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-ar: "Fustat", "Causten", Tahoma, "Geeza Pro", Arial, sans-serif;

  --fw-headline: 800;
  --fw-subheadline: 700;
  --fw-body1: 500;
  --fw-body2: 400;
  --fs-headline: 65px;
  --fs-subheadline: 45px;
  --fs-body1: 25px;
  --fs-body2: 15px;

  /* ECCF primary colour palette (Logo Colour Behaviour – Primary) */
  --eccf-sky: #0094d9;           /* maliwanag na asul — simula ng gradient */
  --eccf-royal: #005baa;         /* pangunahing brand blue */
  --eccf-navy: #004476;          /* madilim na asul */
  --eccf-light: #91d5fd;         /* mapusyaw na asul */
  --eccf-charcoal: #363640;      /* charcoal — text at madilim na surface */
  --eccf-gray: #e7e7e7;          /* mapusyaw na gray */

  /* Brand colours */
  --brand: var(--eccf-royal);
  --brand-2: var(--eccf-royal);
  --brand-3: var(--eccf-sky);
  --brand-ink: var(--eccf-royal); /* brand na kulay para sa text */
  --brand-soft: #e6f4fd;
  --ok: #12a26b;
  --ok-ink: #0b7a50;
  --ok-soft: #e6f7ef;
  --warn: #d68a00;
  --warn-soft: #fff5e0;
  --danger: #e0393e;
  --danger-ink: #b3262a;
  --danger-soft: #fdecec;

  /* Surfaces & text (light) */
  --bg: #f4f5f7;
  --card: #ffffff;
  --field: #fafafb;
  --field-focus: #ffffff;
  --hover: #f7f9fc;
  --ink: var(--eccf-charcoal);
  --ink-2: #4f4f5a;
  --muted: #6e6e7a;
  --placeholder: #a3a3ad;
  --line: var(--eccf-gray);
  --line-2: #d2d2d8;
  --topbar: rgba(255, 255, 255, .86);
  --sidebar: var(--eccf-navy);
  --sidebar-ink: #cfe3f2;
  --sidebar-muted: #8fb3d1;
  --submit-bar: var(--eccf-navy);
  --chip: #ededf0;
  --scrim: rgba(54, 54, 64, .55);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(54, 54, 64, .04), 0 8px 24px rgba(54, 54, 64, .06);
  --shadow-lg: 0 20px 50px rgba(0, 68, 118, .18);
  --focus: 0 0 0 4px rgba(0, 91, 170, .16);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  color-scheme: light;
}

/* ---------- Dark mode ---------- */
html[data-theme="dark"] {
  --brand: var(--eccf-sky);
  --brand-2: var(--eccf-royal);
  --brand-3: var(--eccf-sky);
  --brand-ink: var(--eccf-light);
  --brand-soft: rgba(0, 148, 217, .16);
  --ok: #2bc488;
  --ok-ink: #5ee0ad;
  --ok-soft: rgba(43, 196, 136, .14);
  --warn: #f0a92a;
  --warn-soft: rgba(240, 169, 42, .14);
  --danger: #ff5a5f;
  --danger-ink: #ff8a8e;
  --danger-soft: rgba(255, 90, 95, .14);

  /* Dark surfaces — batay sa ECCF charcoal (#363640) */
  --bg: #1c1c22;
  --card: #26262e;
  --field: #212128;
  --field-focus: #26262e;
  --hover: #2e2e37;
  --ink: #f0f0f2;
  --ink-2: #c9c9d1;
  --muted: #9a9aa6;
  --placeholder: #6a6a76;
  --line: var(--eccf-charcoal);
  --line-2: #4a4a56;
  --topbar: rgba(28, 28, 34, .82);
  --sidebar: #15151a;
  --sidebar-ink: #c9c9d1;
  --sidebar-muted: #8a8a96;
  --submit-bar: var(--eccf-navy);
  --chip: var(--eccf-charcoal);
  --scrim: rgba(0, 0, 0, .65);

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
  --focus: 0 0 0 4px rgba(0, 148, 217, .25);
  color-scheme: dark;
}
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .35s ease, border-color .35s ease, color .35s ease, fill .35s ease, box-shadow .35s ease !important;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: var(--fw-body2);
  font-size: var(--fs-body2);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}
:lang(ar), [dir="rtl"] { font-family: var(--font-ar); }
h1, h2, h3, h4 { font-family: var(--font); }
a { color: var(--brand); }
img, svg { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font-family: inherit; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; padding-left: max(16px, var(--safe-l)); padding-right: max(16px, var(--safe-r)); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.small { font-size: 13px; }
.req { color: var(--danger); font-weight: 700; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Brand type utilities */
.t-headline    { font-size: var(--fs-headline); font-weight: var(--fw-headline); line-height: 1.08; letter-spacing: -.02em; }
.t-subheadline { font-size: var(--fs-subheadline); font-weight: var(--fw-subheadline); line-height: 1.15; letter-spacing: -.01em; }
.t-body1       { font-size: var(--fs-body1); font-weight: var(--fw-body1); line-height: 1.4; }
.t-body2       { font-size: var(--fs-body2); font-weight: var(--fw-body2); line-height: 1.55; }

/* ---------- Theme logo (puting background / itim na background) ---------- */
.brand-logo { display: inline-flex; align-items: center; flex: none; }
.brand-logo img { display: block; height: 100%; width: auto; max-width: none; border-radius: 6px; }
.brand-logo .logo-on-dark { display: none; }
html[data-theme="dark"] .brand-logo .logo-on-light { display: none; }
html[data-theme="dark"] .brand-logo .logo-on-dark { display: block; }

/* ==========================================================
   Light / dark switch
   ========================================================== */
.theme-toggle {
  --tt-w: 60px; --tt-h: 32px; --tt-pad: 3px;
  position: relative; flex: none; display: inline-block;
  width: var(--tt-w); height: var(--tt-h); padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #c8eafe 0%, #91d5fd 100%);
  box-shadow: inset 0 1px 3px rgba(0, 40, 90, .25), 0 1px 0 rgba(255, 255, 255, .6);
  overflow: hidden; isolation: isolate;
  transition: background .45s ease, box-shadow .3s ease;
}
/* ulap (light) at mga bituin (dark) sa track */
.theme-toggle::before {
  content: ""; position: absolute; z-index: -1; right: 7px; top: 50%; width: 18px; height: 7px; border-radius: 99px;
  background: rgba(255, 255, 255, .9);
  box-shadow: -6px -3px 0 -1px rgba(255, 255, 255, .9), 4px -2px 0 -1px rgba(255, 255, 255, .85);
  transform: translateY(-20%); transition: opacity .35s ease, transform .45s ease;
}
.theme-toggle::after {
  content: ""; position: absolute; z-index: -1; left: 11px; top: 9px; width: 2px; height: 2px; border-radius: 50%;
  background: #fff; opacity: 0;
  box-shadow: 8px 7px 0 0 rgba(255,255,255,.8), 15px -2px 0 .5px #fff, 3px 13px 0 0 rgba(255,255,255,.6), 20px 10px 0 0 rgba(255,255,255,.7);
  transform: translateY(6px); transition: opacity .35s ease, transform .45s ease;
}
.tt-knob {
  position: absolute; top: var(--tt-pad); left: var(--tt-pad);
  width: calc(var(--tt-h) - var(--tt-pad) * 2); height: calc(var(--tt-h) - var(--tt-pad) * 2);
  border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, #ffffff, #fff4d6);
  color: #f59e0b;
  box-shadow: 0 2px 6px rgba(0, 30, 70, .3), inset 0 -1px 2px rgba(0, 0, 0, .06);
  transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), background .45s ease, color .45s ease;
}
.tt-icon { position: absolute; width: 16px; height: 16px; transition: opacity .3s ease, transform .5s cubic-bezier(.34, 1.56, .64, 1); }
.tt-sun  { opacity: 1; transform: rotate(0) scale(1); }
.tt-moon { opacity: 0; transform: rotate(-70deg) scale(.4); }

.theme-toggle[aria-checked="true"] {
  background: linear-gradient(135deg, #363640 0%, #15151a 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
}
.theme-toggle[aria-checked="true"]::before { opacity: 0; transform: translate(8px, -20%); }
.theme-toggle[aria-checked="true"]::after  { opacity: 1; transform: none; }
.theme-toggle[aria-checked="true"] .tt-knob {
  transform: translateX(calc(var(--tt-w) - var(--tt-h)));
  background: linear-gradient(145deg, #e9eefc, #b9c6e4);
  color: #33415f;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5), 0 0 14px rgba(185, 205, 255, .35);
}
.theme-toggle[aria-checked="true"] .tt-sun  { opacity: 0; transform: rotate(90deg) scale(.4); }
.theme-toggle[aria-checked="true"] .tt-moon { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle:hover .tt-knob { box-shadow: 0 3px 10px rgba(0, 30, 70, .35), 0 0 0 4px rgba(255, 255, 255, .25); }
.theme-toggle:active .tt-knob { width: calc(var(--tt-h) - var(--tt-pad) * 2 + 4px); }
.theme-toggle:focus-visible { outline: 2px solid var(--brand-3); outline-offset: 3px; }

/* ==========================================================
   Show / hide password (mata)
   ========================================================== */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 48px !important; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 38px; height: 38px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
  transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--brand); background: var(--brand-soft); }
.pw-toggle svg { grid-area: 1 / 1; transition: opacity .2s, transform .25s; }
.pw-toggle .pw-eye-off { opacity: 0; transform: scale(.6); }
.pw-wrap.is-visible .pw-toggle { color: var(--brand); }
.pw-wrap.is-visible .pw-eye { opacity: 0; transform: scale(.6); }
.pw-wrap.is-visible .pw-eye-off { opacity: 1; transform: none; }
input::-ms-reveal, input::-ms-clear { display: none; }

/* ==========================================================
   Pop-up notifications
   ========================================================== */
.toast-stack {
  position: fixed; z-index: 1000; top: calc(16px + var(--safe-t)); right: calc(16px + var(--safe-r));
  width: 380px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.ntf {
  position: relative; display: flex; align-items: flex-start; gap: 12px; overflow: hidden; pointer-events: auto;
  padding: 14px 40px 16px 14px; border-radius: 16px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateX(24px) scale(.97);
  transition: opacity .28s ease, transform .35s cubic-bezier(.2, 1.2, .4, 1);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) and (background: color-mix(in srgb, red 50%, blue)) {
  .ntf { background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: saturate(170%) blur(16px); backdrop-filter: saturate(170%) blur(16px); }
}
.ntf.ntf-in { opacity: 1; transform: none; }
.ntf.ntf-out { opacity: 0; transform: translateX(24px) scale(.97); }
.ntf-ico { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--brand); }
.ntf-success .ntf-ico { background: var(--ok); }
.ntf-error   .ntf-ico { background: var(--danger); }
.ntf-warning .ntf-ico { background: var(--warn); }
.ntf-push    .ntf-ico { background: linear-gradient(135deg, var(--brand-3), var(--brand-2)); }
.ntf-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 500; line-height: 1.4; padding-top: 1px; word-wrap: break-word; }
.ntf-body strong { font-weight: 700; font-size: 14.5px; }
.ntf-body span { color: var(--ink-2); }
.ntf-body strong + span { font-weight: 400; font-size: 13.5px; }
.ntf-close {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.ntf-close:hover { background: var(--hover); color: var(--ink); }
.ntf-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; color: var(--brand); opacity: .55; transform-origin: left; animation: ntf-bar linear forwards; }
.ntf-success .ntf-bar { color: var(--ok); }
.ntf-error .ntf-bar { color: var(--danger); }
.ntf-warning .ntf-bar { color: var(--warn); }
.ntf.ntf-hold .ntf-bar { animation-play-state: paused; }
@keyframes ntf-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .topbar { background: var(--topbar); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); }
}
/* Auto-hide: itinatago kapag nag-scroll pababa (tingnan ang app.js) */
.topbar { transition: transform .28s ease, box-shadow .28s ease; will-change: transform; }
html.hdr-hidden .topbar { transform: translateY(-100%); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.topbar-actions .btn { white-space: nowrap; }
/* Logo: puwedeng lumiit para hindi itulak palabas ng screen ang mga button sa kanan */
.topbar-inner > a { display: flex; align-items: center; align-self: stretch; line-height: 0; flex: 0 1 auto; min-width: 0; }
.logo { height: 60px; }
.topbar .logo { transform: translateY(4px); flex: 0 1 auto; min-width: 0; }
.topbar .brand-logo img { max-width: 100%; object-fit: contain; object-position: left center; }
/* Nakatago muna ang secure-pill sa header */
.secure-pill {
  display: none; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--ok-ink);
  background: var(--ok-soft); border-radius: 999px; padding: 6px 12px; white-space: nowrap;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: #005fad;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(0, 139, 209, .35), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(0, 95, 173, .45), transparent 60%),
    linear-gradient(135deg, #04345f 0%, #005fad 55%, #0089cf 100%);
  color: #fff;
  padding: 48px 0 96px;
}
html[data-theme="dark"] .hero {
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(0, 139, 209, .25), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(0, 95, 173, .3), transparent 60%),
    linear-gradient(135deg, #031a33 0%, #04345f 55%, #005a96 100%);
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 60px, transparent 60px 160px);
  pointer-events: none;
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); padding: 6px 12px; border-radius: 999px;
}
/* Headline — 65 ExtraBold */
.hero h1 {
  font-size: 34px;
  font-size: clamp(30px, 1.1rem + 3.4vw, var(--fs-headline));
  font-weight: var(--fw-headline); line-height: 1.06; margin: 14px 0 18px; letter-spacing: -.025em;
}
.hero h1 span { color: #91d5fd; }
/* Body text 1 — Medium (ang sulat sa hero) */
.letter {
  font-size: 15px;
  font-size: clamp(15px, .8rem + .45vw, 18px);
  font-weight: var(--fw-body1); color: rgba(255,255,255,.88); max-width: 680px;
}
.letter p { margin: 0 0 10px; }
.letter strong { color: #fff; font-weight: 700; }
.letter .sign { margin-top: 16px; font-style: italic; }
.letter .sign strong { font-style: normal; letter-spacing: .02em; }

.dl-card {
  background: var(--card); color: var(--ink);
  border-radius: 20px; padding: 22px; box-shadow: var(--shadow-lg);
}
.dl-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 19px; font-weight: var(--fw-subheadline); color: var(--brand-ink); }
.dl-card > p { margin: 0 0 16px; font-size: 13.5px; }
/* minmax(0, 1fr): para hindi lumampas sa card ang mahahabang pangalan ng file */
.dl-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.dl-btn {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card); min-height: 64px; min-width: 0;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.dl-btn:hover { border-color: var(--brand-3); box-shadow: 0 8px 20px rgba(0, 91, 170, .14); transform: translateY(-1px); }
.dl-btn.is-disabled { opacity: .55; cursor: not-allowed; }
.dl-btn.is-disabled:hover { transform: none; box-shadow: none; border-color: var(--line); }
.dl-ico {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-3), var(--brand-2)); color: #fff;
}
.dl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-text strong { font-size: 14.5px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
/* Hanggang 2 linya ang description, saka puputulin ng ellipsis */
.dl-text small {
  color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 2px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.dl-arrow { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start;
  margin-top: -56px; position: relative; z-index: 2; padding-bottom: 48px;
}
.stepnav {
  position: -webkit-sticky; position: sticky; top: calc(88px + var(--safe-t));
  transition: top .28s ease;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
html.hdr-hidden .stepnav { top: calc(20px + var(--safe-t)); }
.progress-card { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.progress-card strong { display: block; font-size: 14px; font-weight: 700; }
.progress-card small { color: var(--muted); font-size: 12px; }
.ring {
  --p: 0; flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0);
  transition: background .3s;
}
.ring span {
  width: 42px; height: 42px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800; color: var(--brand-ink);
}
.stepnav ol { list-style: none; margin: 0; padding: 0; }
.stepnav a {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px;
}
.stepnav a:hover { background: var(--bg); }
.stepnav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.stepnav a i {
  flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); position: relative;
  transition: all .2s;
}
.stepnav a.done i { background: var(--ok); border-color: var(--ok); }
.stepnav a.done i::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.draft-note { margin: 12px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Cards ---------- */
.kyc-form { display: grid; gap: 22px; min-width: 0; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px; border: 1px solid transparent;
}
html[data-theme="dark"] .card, html[data-theme="dark"] .panel, html[data-theme="dark"] .stat,
html[data-theme="dark"] .stepnav, html[data-theme="dark"] .dl-card { border: 1px solid var(--line); }
.card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 22px; }
.card-head .num {
  flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-3), var(--brand-2)); color: #fff; font-weight: 800;
  box-shadow: 0 6px 14px rgba(0, 91, 170, .3);
}
/* Sub-Headline — Bold */
.card-head h2 { margin: 0; font-size: 20px; font-size: clamp(18px, .95rem + .5vw, 22px); font-weight: var(--fw-subheadline); letter-spacing: -.01em; line-height: 1.25; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 18px; }
.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=date], .field input[type=url],
.field input[type=number], .field input[type=password], .field input[type=search], .field select, .field textarea {
  width: 100%; font: inherit; font-weight: 500; color: var(--ink); min-height: 46px;
  background: var(--field); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
.field select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236e6e7a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field input[type=date] { min-height: 46px; }
.field textarea { resize: vertical; min-height: 90px; }
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); opacity: 1; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line-2); }
.field input:focus, .field select:focus, .field textarea:focus {
  background-color: var(--field-focus); border-color: var(--brand); box-shadow: var(--focus);
}
.field.invalid input, .field.invalid select { border-color: var(--danger); background-color: var(--danger-soft); }
.field.invalid input:focus { box-shadow: 0 0 0 4px rgba(224, 57, 62, .14); }
.field.valid input { border-color: rgba(18, 162, 107, .35); }
.country-field input { margin-top: 8px; }
.field input[type=file] { font-size: 13px; color: var(--ink-2); max-width: 100%; }
.field input[type=color] {
  width: 54px; height: 46px; padding: 4px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--field); cursor: pointer;
}
html[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.err { color: var(--danger); font-size: 12px; min-height: 0; }
.err:empty { display: none; }

.subgroup { border: 0; padding: 0; margin: 22px 0; min-width: 0; }
.subgroup legend { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 12px; padding: 0; }
.subgroup legend em { font-style: normal; font-weight: 600; color: var(--brand-ink); background: var(--brand-soft); padding: 2px 8px; border-radius: 6px; font-size: 12.5px; margin-left: 4px; }

/* Partner type choice */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice { cursor: pointer; position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px;
  align-items: center; padding: 16px 44px 16px 18px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--field); transition: all .18s; position: relative;
}
.choice-body strong { font-weight: 700; }
.choice-body svg { grid-row: span 2; color: var(--muted); }
.choice-body small { color: var(--muted); font-size: 12.5px; }
.choice-body::after {
  content: ""; position: absolute; right: 14px; top: 14px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line-2); background: var(--card);
}
.choice input:checked + .choice-body { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 4px rgba(0, 91, 170, .1); }
.choice input:checked + .choice-body svg { color: var(--brand); }
.choice input:checked + .choice-body::after { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px var(--card); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Departments */
.dept { border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; background: var(--card); }
.dept:last-child { margin-bottom: 0; }
.dept h3 { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 700; margin: 0 0 16px; letter-spacing: .02em; }
.dept h3 em { font-weight: 500; color: var(--muted); font-size: 12.5px; letter-spacing: 0; }
.dept-ico { flex: none; width: 30px; height: 30px; display: grid; place-items: center; background: var(--brand-soft); border-radius: 9px; font-size: 15px; }
.dept-opt { transition: opacity .2s; }
.dept-opt.dim { opacity: .35; }
.dept-sep { margin: 0 6px; color: var(--muted); }
.link-btn {
  margin-top: 12px; background: none; border: 0; padding: 4px 0; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--brand); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Dropzones ---------- */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dropzone { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dz-inner {
  display: flex; align-items: center; gap: 12px; padding: 16px; cursor: pointer;
  border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--field); transition: all .18s;
}
.dz-inner:hover, .dropzone.drag .dz-inner { border-color: var(--brand); background: var(--brand-soft); }
.dz-ico { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--card); color: var(--brand); box-shadow: 0 2px 6px rgba(54, 54, 64,.08); }
.dz-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dz-text strong { font-size: 13.5px; font-weight: 700; }
.dz-text small { color: var(--muted); font-size: 12px; }
.dz-text u { color: var(--brand); text-decoration: none; font-weight: 600; }
.dz-check { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: var(--line-2); transition: background .2s; }
.dropzone.has-files .dz-inner { border-style: solid; border-color: rgba(18, 162, 107, .45); background: var(--ok-soft); }
.dropzone.has-files .dz-check { background: var(--ok); }
.dropzone.invalid .dz-inner { border-color: var(--danger); background: var(--danger-soft); }
.dz-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dz-files:empty { display: none; }
.dz-files li {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 8px 7px 10px;
}
.dz-files .fname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.dz-files .fsize { color: var(--muted); flex: none; }
.dz-files .ftype { flex: none; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px; background: var(--brand-soft); color: var(--brand-ink); }
.dz-files button { flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.dz-files button:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- Signature & stamp ---------- */
/* Signature lang ang nakikita (naka-hide ang stamp), kaya naka-center ito sa card */
.sign-grid { display: grid; grid-template-columns: minmax(0, 560px); justify-content: center; gap: 18px; margin-top: 20px; }
.sigpad {
  position: relative; height: 180px; border: 1.5px dashed var(--line-2); border-radius: 14px;
  /* Laging puti ang signature pad (para tama ang kulay ng pirma sa PDF) */
  background:
    linear-gradient(transparent calc(100% - 46px), #e7e7e7 calc(100% - 46px), #e7e7e7 calc(100% - 45px), transparent calc(100% - 45px)),
    #fcfdff;
  touch-action: none;
}
.sigpad.invalid { border-color: var(--danger); }
.sigpad.signed { border-style: solid; border-color: var(--brand); }
.sigpad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.sig-hint { position: absolute; left: 0; right: 0; top: 42%; text-align: center; color: #8e8e99; font-size: 13px; pointer-events: none; }
.sig-clear {
  position: absolute; right: 10px; top: 10px; border: 1px solid #e7e7e7; background: #fff; border-radius: 8px;
  font: inherit; font-size: 12px; font-weight: 600; padding: 6px 12px; cursor: pointer; color: #4f4f5a;
}
.sig-clear:hover { color: var(--danger); border-color: var(--danger); }
.sig-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.sig-label > label { margin: 0; }
.sig-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--field); border: 1px solid var(--line); }
.sig-tabs button {
  border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px;
  border-radius: 7px; cursor: pointer; color: var(--muted);
}
.sig-tabs button.active { background: var(--brand); color: #fff; }
.sig-upload.invalid { border-color: var(--danger); }
.sig-upload.signed { border-style: solid; border-color: var(--brand); }
.sig-upload img { background: transparent; }
.sigpad[hidden], .sig-upload[hidden] { display: none; }
.stamp-box {
  position: relative; height: 180px; display: grid; place-items: center; cursor: pointer; overflow: hidden;
  border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--field); transition: all .18s;
}
.stamp-box:hover { border-color: var(--brand); background: var(--brand-soft); }
.stamp-box input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.stamp-box img { max-height: 160px; max-width: 90%; object-fit: contain; background: #fff; border-radius: 8px; }
.stamp-ph { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }

.agree {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; padding: 14px 16px; border-radius: 12px;
  background: var(--bg); font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.agree input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand); flex: none; }
.agree.invalid { background: var(--danger-soft); }

/* ---------- Submit bar ---------- */
.submit-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: var(--submit-bar); color: #fff; border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow-lg);
}
html[data-theme="dark"] .submit-bar { border: 1px solid var(--line); }
.submit-info { display: flex; flex-direction: column; font-size: 13px; color: rgba(255,255,255,.75); }
.submit-info strong { color: #fff; font-size: 17px; font-weight: 700; }
.btn-submit {
  flex: none; display: inline-flex; align-items: center; gap: 10px; border: 0; cursor: pointer;
  font: inherit; font-weight: 800; letter-spacing: .06em; font-size: 15px; color: #fff;
  padding: 15px 30px; border-radius: 12px; min-height: 50px;
  background: linear-gradient(135deg, var(--brand-3), var(--brand-2));
  box-shadow: 0 10px 24px rgba(0, 148, 217, .45); transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn-submit:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 14px 30px rgba(0, 148, 217, .55); }
.btn-submit:disabled { opacity: .6; cursor: progress; transform: none; }

/* ---------- Overlay / legacy toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); padding: 16px; }
.overlay-card { background: var(--card); color: var(--ink); border-radius: 20px; padding: 30px; width: 100%; max-width: 360px; text-align: center; display: grid; gap: 12px; justify-items: center; box-shadow: var(--shadow-lg); }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: 100%; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-3), var(--brand-2)); transition: width .2s; }
/* Mobile download confirm (ECCF Documents) */
.dl-confirm .overlay-card { padding: 24px 20px 20px; }
.dl-confirm #dlConfirmName { overflow-wrap: anywhere; }
.dl-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 6px; }
.dl-confirm-actions .btn { min-height: 46px; }
.dl-status { width: 100%; display: grid; gap: 6px; justify-items: center; }
.dl-status small { color: var(--ink-2); font-size: 12.5px; }
.dl-confirm.is-saving .dl-ico { animation: dl-pulse 1.2s ease-in-out infinite; }
.dl-confirm.is-done .dl-ico { background: var(--ok); }
@keyframes dl-pulse { 50% { transform: scale(.9); opacity: .75; } }
@media (prefers-reduced-motion: reduce) { .dl-confirm.is-saving .dl-ico { animation: none; } }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 110; max-width: calc(100% - 32px);
  background: var(--danger); color: #fff; font-weight: 600; font-size: 14px; padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow-lg); animation: up .25s ease-out;
}
.toast.ok { background: var(--ok); }
@keyframes up { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Footer ---------- */
.site-footer { background: linear-gradient(90deg, #005baa, #0094d9); color: #fff; font-size: 13.5px; padding: 18px 0; padding-bottom: calc(18px + var(--safe-b)); }
html[data-theme="dark"] .site-footer { background: linear-gradient(90deg, #00304f, #004476); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: space-between; }
.site-footer a { color: #fff; text-decoration: none; }

/* ---------- Success page ---------- */
.success-wrap { min-height: calc(100vh - 76px - 56px); min-height: calc(100dvh - 76px - 56px); display: grid; place-items: center; padding: 40px 16px; }
.success-card { background: var(--card); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 40px 32px; max-width: 560px; width: 100%; text-align: center; }
html[data-theme="dark"] .success-card { border: 1px solid var(--line); }
.success-ico { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); animation: pop .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.success-card h1 { margin: 0 0 8px; font-size: 34px; font-size: clamp(28px, 1rem + 2.4vw, 44px); font-weight: var(--fw-headline); letter-spacing: -.02em; line-height: 1.1; }
.success-card p { color: var(--ink-2); margin: 0 0 18px; }
.ref-box { display: inline-flex; flex-direction: column; gap: 2px; padding: 14px 24px; border-radius: 14px; background: var(--brand-soft); border: 1px dashed var(--brand-3); margin-bottom: 22px; max-width: 100%; }
.ref-box small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.ref-box strong { font-size: 24px; font-weight: 800; color: var(--brand-ink); letter-spacing: .04em; word-break: break-all; }

/* ---------- Buttons (shared) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 14px;
  padding: 10px 16px; min-height: 42px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--line-2); background: var(--hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand-3), var(--brand-2)); color: #fff; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.07); background: linear-gradient(135deg, var(--brand-3), var(--brand-2)); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(224, 57, 62, .35); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 6px 11px; min-height: 34px; font-size: 13px; border-radius: 8px; }
.btn-ok { background: var(--ok); color: #fff; border-color: transparent; }

/* ==========================================================
   Admin
   ========================================================== */
body.admin { background: var(--bg); }
.admin-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-ink); padding: 22px 16px; padding-top: calc(22px + var(--safe-t)); padding-left: max(16px, var(--safe-l));
  position: -webkit-sticky; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 20px 8px; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; font-weight: 800; font-size: 15px; text-decoration: none; line-height: 1.25; }
.sidebar .brand > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar .brand .mark { flex: none; width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.sidebar .brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--sidebar-muted); }
.sidebar .nav-list { display: flex; flex-direction: column; gap: 4px; }
.sidebar a.nav, .sidebar button.nav {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--sidebar-ink);
  text-decoration: none; font: inherit; font-weight: 600; font-size: 14px; background: none; border: 0; cursor: pointer; text-align: left; width: 100%;
}
.sidebar .nav > span:first-child { width: 22px; text-align: center; flex: none; }
.sidebar a.nav:hover, .sidebar button.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.nav.active { background: rgba(0, 148, 217, .22); color: #fff; }
.sidebar .nav-cta { color: #fff; background: rgba(0, 148, 217, .18); border: 1px dashed rgba(145, 213, 253, .35) !important; }
.sidebar .spacer { flex: 1; }
.sidebar .who { font-size: 12.5px; color: var(--sidebar-muted); padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .who strong { color: var(--sidebar-ink); }
.admin-main { min-width: 0; padding: 26px 28px 48px; padding-right: max(28px, var(--safe-r)); padding-bottom: calc(48px + var(--safe-b)); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; font-size: clamp(22px, 1rem + 1vw, 30px); font-weight: var(--fw-headline); letter-spacing: -.015em; line-height: 1.2; word-break: break-word; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; border: 1.5px solid transparent; }
.stat:hover { border-color: var(--line-2); }
.stat.on { border-color: var(--brand) !important; }
.stat small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat strong { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; font-weight: var(--fw-subheadline); }
.panel-body { padding: 18px; }
.search { display: flex; gap: 8px; flex-wrap: wrap; }
.search input, .search select {
  font: inherit; font-size: 14px; padding: 8px 12px; min-height: 38px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--field); color: var(--ink); outline: none; min-width: 0;
}
.search input:focus, .search select:focus { border-color: var(--brand); background: var(--field-focus); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 12px 16px; background: var(--field); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl .ref { font-weight: 700; color: var(--brand-ink); text-decoration: none; white-space: nowrap; }
.tbl .sub { display: block; color: var(--muted); font-size: 12.5px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-new { background: var(--brand-soft); color: var(--brand-ink); }
.badge-reviewed { background: var(--warn-soft); color: var(--warn); }
.badge-approved { background: var(--ok-soft); color: var(--ok-ink); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-type { background: var(--chip); color: var(--ink-2); }

.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a, .pager span { min-width: 36px; text-align: center; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.detail-grid > * { min-width: 0; }
.stack { display: grid; gap: 20px; min-width: 0; }
dl.kv { display: grid; grid-template-columns: 200px minmax(0, 1fr); margin: 0; }
dl.kv dt, dl.kv dd { padding: 9px 0; border-bottom: 1px dashed var(--line); margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); font-weight: 600; padding-right: 12px; }
dl.kv dd { font-weight: 600; word-break: break-word; }
dl.kv dt:last-of-type, dl.kv dd:last-of-type { border-bottom: 0; }
.kv-title { font-size: 13px; font-weight: 800; letter-spacing: .05em; color: var(--brand-ink); margin: 18px 0 4px; }
.kv-title:first-child { margin-top: 0; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.file-list .meta { min-width: 0; }
/* Hanggang 2 linya ang file name para mabasa kahit mahaba; buo ang pangalan sa tooltip */
.file-list .meta strong {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; word-break: break-word;
}
.file-list .meta small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.file-actions { display: flex; gap: 6px; flex: none; }
.file-actions .btn-sm { padding: 6px 10px; }
.doc-group { margin-bottom: 16px; }
.doc-group:last-child { margin-bottom: 0; }
.doc-group h4 { margin: 0 0 8px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.missing { font-size: 12.5px; color: var(--danger); }
.sig-view { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fcfdff; text-align: center; }
.sig-view img { max-height: 120px; }
html[data-theme="dark"] .sig-view .muted { color: #6e6e7a; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.flash-success { background: var(--ok-soft); color: var(--ok-ink); }
.flash-error { background: var(--danger-soft); color: var(--danger-ink); }
.flash-warning { background: var(--warn-soft); color: var(--warn); }
.flash-info { background: var(--brand-soft); color: var(--brand-ink); }

/* Login */
.login-wrap {
  position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: 24px 16px; padding-top: calc(24px + var(--safe-t)); padding-bottom: calc(24px + var(--safe-b));
  background: #005baa;
  background: radial-gradient(800px 400px at 80% 0%, rgba(0,148,217,.35), transparent 60%), linear-gradient(135deg, #0094d9, #005baa);
}
html[data-theme="dark"] .login-wrap { background: radial-gradient(800px 400px at 80% 0%, rgba(0,148,217,.18), transparent 60%), linear-gradient(135deg, #00304f, #004476); }
.login-wrap > .theme-toggle { position: absolute; top: calc(18px + var(--safe-t)); right: calc(18px + var(--safe-r)); }
.login-card { width: 100%; max-width: 410px; background: var(--card); border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; }
html[data-theme="dark"] .login-card { border: 1px solid var(--line); }
/* Logo sa login: sinasakop ang buong lapad ng card; may max-height para hindi lumobo ang square/matataas na custom logo */
.login-card .login-logo { justify-self: stretch; display: block; }
.login-card .brand-logo { display: block; width: 100%; height: auto; }
.login-card .brand-logo img { width: 100%; height: auto; max-height: 120px; object-fit: contain; border-radius: 0; }
.login-card h1 { font-size: 22px; font-weight: var(--fw-headline); margin: 4px 0 0; text-align: center; }
.login-card .btn { width: 100%; padding: 12px; min-height: 48px; }

/* Company docs manager */
.doc-row { display: grid; grid-template-columns: 1.2fr 1.4fr 90px 90px auto; gap: 12px; align-items: start; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: 0; }
/* Pantay ang unang input ng bawat column: fixed label height (20px) + gap (6px) = 26px offset */
.doc-row .field label { line-height: 20px; }
.doc-row > .toggle, .doc-row > .actions { margin-top: 26px; min-height: 46px; align-items: center; padding-bottom: 0; }
.doc-row .cur-file { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: block; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; padding-bottom: 10px; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }

/* Settings / branding */
.brand-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.brand-slot { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.brand-slot h3 { margin: 0; font-size: 14px; font-weight: 700; }
.brand-slot p { margin: 0; font-size: 12.5px; color: var(--muted); }
.brand-preview { height: 110px; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 14px; overflow: hidden; border: 1px solid var(--line); }
.brand-preview img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.brand-preview.on-white { background: #ffffff; }
.brand-preview.a4 { height: 220px; padding: 10px; }
.brand-preview.a4 img { aspect-ratio: 210 / 297; object-fit: cover; height: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.brand-preview.on-black { background: #000000; border-color: #000; }
.brand-preview.on-check { background: conic-gradient(#e9eef5 25%, #fff 0 50%, #e9eef5 0 75%, #fff 0) 0 0 / 16px 16px; }
.icon-preview { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.icon-preview figure { margin: 0; display: grid; justify-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.icon-preview .tile { display: grid; place-items: center; overflow: hidden; background: var(--icon-bg, #005baa); box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.icon-preview .tile img { width: 100%; height: 100%; object-fit: contain; }
.icon-preview .ios { width: 60px; height: 60px; border-radius: 14px; }
.icon-preview .android { width: 60px; height: 60px; border-radius: 50%; }
.icon-preview .android img { width: 72%; height: 72%; }
.icon-preview .fav { width: 32px; height: 32px; border-radius: 6px; background: transparent; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=text] { max-width: 140px; }
.home-preview {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px;
  background: linear-gradient(135deg, #3a6ea5, #7d5fb2); color: #fff;
}
.home-preview img { width: 56px; height: 56px; border-radius: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.home-preview span { font-size: 12px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.4); max-width: 90px; text-align: center; line-height: 1.2; }
.home-preview .app { display: grid; justify-items: center; gap: 6px; }
.push-state { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; }
.push-state::before { content: ""; flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--muted); }
html[data-push="on"] .push-state::before { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
/* Naka-minimize na sidebar (desktop lang): icons na lang ang makikita.
   I-click ang main page para lumiit; i-click ang sidebar para lumaki ulit. */
@media (min-width: 961px) {
  .admin-shell { transition: grid-template-columns .25s ease; }
  html.sb-mini .admin-shell { grid-template-columns: 76px minmax(0, 1fr); }
  html.sb-mini .sidebar { padding-left: 12px; padding-right: 12px; overflow-x: hidden; cursor: pointer; }
  html.sb-mini .sidebar-top { justify-content: center; padding: 4px 0 20px; }
  html.sb-mini .sidebar .brand > span,
  html.sb-mini .sidebar .theme-toggle,
  html.sb-mini .sidebar .nav-label,
  html.sb-mini .sidebar .who { display: none; }
  html.sb-mini .sidebar a.nav, html.sb-mini .sidebar button.nav { justify-content: center; padding: 10px 0; }
  html.sb-mini .sidebar .nav > span:first-child { font-size: 17px; }
}

html[data-push="blocked"] .push-state::before { background: var(--danger); }
.steps { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 4px; }

/* ==========================================================
   Responsive — malaking desktop, laptop, tablet, phone, maliit na phone
   ========================================================== */
@media (min-width: 1600px) {
  .wrap { max-width: 1320px; }
  .layout { grid-template-columns: 280px minmax(0, 1fr); }
  .admin-main { padding: 32px 40px 56px; }
}
@media (max-width: 1280px) {
  .doc-row { grid-template-columns: 1fr 1.2fr 80px 80px; }
  .doc-row > .actions { grid-column: 1 / -1; margin-top: 0; min-height: 0; }
}
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  /* Buong lapad na ang attachments panel: gawing multi-column ang listahan */
  .file-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
}
/* Tablet (iPad portrait, Android tablets) */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .dl-card { max-width: none; }
  /* Tablet: dalawang column ang mga dokumento kapag kasya */
  .dl-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
  .layout { grid-template-columns: minmax(0, 1fr); margin-top: -56px; }
  .stepnav { position: static; display: none; }

  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: -webkit-sticky; position: sticky; top: 0; z-index: 50; height: auto; overflow: visible;
    padding: 10px 16px 0; padding-top: calc(10px + var(--safe-t)); padding-left: max(16px, var(--safe-l)); padding-right: max(16px, var(--safe-r));
    gap: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    transition: transform .28s ease;
  }
  /* Auto-hide ng pahalang na admin nav; dagdag na 30px para hindi sumilip ang anino */
  html.hdr-hidden .sidebar { transform: translateY(calc(-100% - 30px)); }
  .sidebar-top { padding: 0; }
  .sidebar .nav-list {
    flex-direction: row; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin: 0 -16px; padding: 0 16px 10px; scroll-snap-type: x proximity;
  }
  .sidebar .nav-list::-webkit-scrollbar { display: none; }
  .sidebar a.nav, .sidebar button.nav { flex: none; width: auto; white-space: nowrap; padding: 8px 12px; font-size: 13.5px; scroll-snap-align: start; }
  .sidebar .spacer, .sidebar .who { display: none; }
  .doc-row { grid-template-columns: 1fr 1fr; }
}
/* Phone */
@media (max-width: 680px) {
  :root { --fs-body2: 14.5px; }
  .topbar-inner { height: 66px; }
  .logo { height: 50px; }
  .hero { padding: 28px 0 80px; }
  .dl-card { padding: 18px 16px; border-radius: 16px; }
  .dl-card h2 { font-size: 18px; }
  .card { padding: 20px 16px; }
  .card-head { gap: 12px; margin-bottom: 18px; }
  .col-6, .col-4 { grid-column: span 12; }
  .choice-grid, .upload-grid, .sign-grid { grid-template-columns: 1fr; }
  .submit-bar { flex-direction: column; align-items: stretch; text-align: center; padding: 18px 16px; }
  .btn-submit { justify-content: center; }
  .footer-inner { flex-direction: column; }
  .admin-main { padding: 18px 16px 40px; padding-bottom: calc(40px + var(--safe-b)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .stat { padding: 12px 14px; }
  .stat strong { font-size: 24px; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { padding-bottom: 0; border-bottom: 0; }
  .doc-row { grid-template-columns: 1fr; }
  .doc-row > .toggle { margin-top: 0; min-height: 0; }
  .file-list { grid-template-columns: minmax(0, 1fr); }
  .dept { padding: 14px; }
  .dept-sep { display: none; }
  .dept h3 > span:last-child { display: flex; flex-direction: column; }
  .page-head { align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .panel-head { padding: 12px 14px; }
  .panel-body { padding: 14px; }
  .search { width: 100%; }
  .search input[type=search] { flex: 1 1 100%; }
  .search select, .search .btn { flex: 1 1 auto; }
  .tbl th, .tbl td { padding: 11px 12px; }
  .brand-grid { grid-template-columns: 1fr; }
  .success-card { padding: 32px 20px; }
  /* iOS: hindi mag-zoom kapag nag-focus sa input (kailangan ≥16px) */
  .field input, .field select, .field textarea, .search input, .search select { font-size: 16px; }
  .toast-stack { top: auto; bottom: calc(12px + var(--safe-b)); right: 12px; left: 12px; width: auto; max-width: none; }
  .ntf, .ntf.ntf-out { transform: translateY(16px) scale(.98); }
  .ntf.ntf-in { transform: none; }
  .login-card { padding: 28px 20px; }
}
/* Maliliit na phone (iPhone SE / mini, lumang Android 320–375px) */
@media (max-width: 380px) {
  .wrap { padding-left: max(12px, var(--safe-l)); padding-right: max(12px, var(--safe-r)); }
  .logo { height: 44px; }
  .theme-toggle { --tt-w: 52px; --tt-h: 28px; }
  .tt-icon { width: 14px; height: 14px; }
  .card { padding: 18px 12px; border-radius: 14px; }
  .dl-card { padding: 16px; }
  .dl-btn { gap: 10px; padding: 10px 12px; }
  .dl-ico { width: 36px; height: 36px; border-radius: 10px; }
  .dl-arrow { width: 30px; height: 30px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .btn-submit { padding: 14px 18px; }
  .sidebar .brand > span { font-size: 14px; }
  /* Sobrang kitid: ilipat ang mga button sa ilalim ng file name */
  .file-list li { grid-template-columns: minmax(0, 1fr); }
  .file-actions .btn-sm { flex: 1 1 0; }
}
/* Phone na naka-landscape / maiikling screen */
@media (max-height: 520px) and (orientation: landscape) {
  .topbar { position: static; }
  .sidebar { position: static; }
  html.hdr-hidden .topbar, html.hdr-hidden .sidebar { transform: none; }
  .hero { padding: 24px 0 72px; }
  .success-wrap { min-height: 0; }
}
/* Touch devices: mas malaking pindutan */
@media (pointer: coarse) {
  .btn-sm { min-height: 38px; }
  .pager a, .pager span { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Naka-install na app (standalone) */
html.is-standalone .topbar { padding-top: max(var(--safe-t), 0px); }

@media print {
  .topbar, .sidebar, .toast-stack, .theme-toggle, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- Partner accounts (portal + admin) ---------- */
.center { text-align: center; }
.stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.link-reveal { margin-bottom: 20px; border: 1.5px solid var(--brand); }
.link-reveal .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; width: 100%; }
.partner-chip { max-width: 240px; }
.partner-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-main { padding-top: 32px; padding-bottom: 48px; min-height: calc(100vh - 76px - 56px); min-height: calc(100dvh - 76px - 56px); }
.portal-main .eyebrow { margin-bottom: 8px; background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.portal-login { min-height: calc(100vh - 76px - 56px); min-height: calc(100dvh - 76px - 56px); }
.login-step { display: grid; gap: 14px; }
.login-card p { margin: 0; }
.code-input { font-size: 24px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.linkish { background: none; border: 0; padding: 4px; color: var(--brand-ink); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
@media (max-width: 680px) {
  .stats.stats-3 .stat:first-child { grid-column: auto; }
  .stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row-actions { justify-content: flex-start; }
  .partner-chip { max-width: 150px; }
}
@media (max-width: 380px) {
  .partner-chip-name { display: none; }
}

/* ---------- Form users (login sa root ng form) ---------- */
.user-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 200px; font-size: 13px; font-weight: 600; }
@media (max-width: 680px) {
  .user-chip { max-width: 110px; }
  .topbar-inner { gap: 10px; }
  .topbar-actions { gap: 8px; }
}
/* Phone: logo + Sign out + toggle lang ang kasya; itago ang pangalan */
@media (max-width: 480px) {
  .user-chip { display: none; }
  .partner-chip-name { display: none; }
  .partner-chip { padding-left: 10px; padding-right: 10px; }
}
.topbar .show-xs { display: none; }
@media (max-width: 420px) { .topbar .hide-xs { display: none; } .topbar .show-xs { display: inline; } }
