
/* ==========================================================
   EPiK v8 — Premium App Experience
   UI-only redesign. Backend behavior intentionally unchanged.
   ========================================================== */

:root{
  --app-bg:#f4f4f2;
  --app-surface:#ffffff;
  --app-surface-soft:#f8f8f7;
  --app-ink:#111111;
  --app-muted:#666a67;
  --app-line:#deded9;
  --app-shadow:0 20px 60px rgba(0,0,0,.08);
  --app-shadow-soft:0 8px 26px rgba(0,0,0,.055);
  --app-radius-xl:28px;
  --app-radius-lg:22px;
  --app-radius-md:16px;
  --app-max:1180px;
  --app-safe-top:env(safe-area-inset-top,0px);
  --app-safe-bottom:env(safe-area-inset-bottom,0px);
  --app-nav-h:78px;
}

*{box-sizing:border-box}
html{
  -webkit-text-size-adjust:100%;
  scroll-behavior:smooth;
  background:var(--app-bg);
}
body{
  margin:0;
  color:var(--app-ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(255,255,255,.95), transparent 35%),
    linear-gradient(180deg,#f8f8f6 0%,#f1f1ef 100%);
  font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  min-height:100vh;
}

button,input,textarea,select{font:inherit}
button,.btn,a,input,textarea,select{touch-action:manipulation}
button,.btn{cursor:pointer}

body::before{
  content:"";
  position:fixed;
  inset:0 0 auto 0;
  height:220px;
  background:linear-gradient(180deg,rgba(255,255,255,.85),rgba(255,255,255,0));
  pointer-events:none;
  z-index:-1;
}

/* ---------- Brand header ---------- */
.top,
header.top{
  position:relative;
  padding:22px 22px 24px !important;
  background:var(--brand,#111)!important;
  color:#fff!important;
  border-radius:0 0 30px 30px!important;
  box-shadow:0 20px 55px rgba(0,0,0,.15)!important;
}
.topin{
  max-width:var(--app-max)!important;
  margin:0 auto!important;
  min-height:72px;
}
.brand{
  font-size:clamp(22px,2.4vw,30px)!important;
  font-weight:950!important;
  letter-spacing:-.025em;
}
.sub{
  font-size:14px!important;
  opacity:.8!important;
  margin-top:5px!important;
}
.mark,.ep{
  width:68px!important;
  height:68px!important;
  border-radius:19px!important;
  box-shadow:0 8px 24px rgba(0,0,0,.14);
}

/* ---------- Mobile/desktop app bar ---------- */
.app-mobile-topbar{
  display:none;
}
.app-desktop-ribbon{
  width:min(calc(100% - 28px),var(--app-max));
  margin:18px auto 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 14px 12px 18px;
  border:1px solid rgba(0,0,0,.06);
  background:rgba(255,255,255,.88);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  border-radius:20px;
  box-shadow:var(--app-shadow-soft);
}
.app-desktop-ribbon strong{
  font-size:15px;
  letter-spacing:-.01em;
}
.app-desktop-ribbon span{
  color:var(--app-muted);
  font-size:13px;
}
.app-ribbon-pill{
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:9px 12px;
  border-radius:999px;
  background:#111;
  color:#fff!important;
  font-size:12px!important;
  font-weight:850;
}

/* ---------- Main layout ---------- */
main{
  width:min(calc(100% - 28px),var(--app-max))!important;
  max-width:var(--app-max)!important;
  margin:26px auto 80px!important;
  padding:0!important;
}
.card,.panel,.step,.section,.box{
  background:rgba(255,255,255,.96)!important;
  border:1px solid var(--app-line)!important;
  border-radius:var(--app-radius-xl)!important;
  box-shadow:var(--app-shadow-soft)!important;
}
.card{
  padding:clamp(22px,3vw,34px)!important;
  margin-bottom:20px!important;
}
.panel{
  padding:22px!important;
  margin-top:18px!important;
}

/* ---------- Typography ---------- */
h1,h2,h3{
  color:var(--app-ink)!important;
  letter-spacing:-.035em;
  text-wrap:balance;
}
h1{
  font-size:clamp(34px,5vw,58px)!important;
  line-height:1.02!important;
  font-weight:950!important;
  margin:0 0 12px!important;
}
h2{
  font-size:clamp(26px,3vw,36px)!important;
  line-height:1.08!important;
  font-weight:930!important;
}
h3{
  font-size:clamp(20px,2vw,25px)!important;
  line-height:1.15!important;
  font-weight:900!important;
}
p,.lead{
  font-size:17px!important;
  line-height:1.65!important;
}
.lead{
  color:var(--app-muted)!important;
  max-width:760px;
}
.small{
  font-size:14px!important;
  line-height:1.5!important;
  color:var(--app-muted)!important;
}
label{
  display:block;
  margin:0 0 8px!important;
  color:#242424!important;
  font-size:15px!important;
  font-weight:850!important;
  letter-spacing:-.01em;
}

/* ---------- Form fields ---------- */
input,textarea,select{
  width:100%;
  min-height:58px!important;
  padding:15px 16px!important;
  border:1.5px solid #d5d5d0!important;
  border-radius:16px!important;
  background:#fff!important;
  color:#111!important;
  font-size:17px!important;
  line-height:1.3!important;
  outline:none!important;
  transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease;
}
textarea{
  min-height:150px!important;
  resize:vertical!important;
}
input:focus,textarea:focus,select:focus{
  border-color:var(--brand,#111)!important;
  box-shadow:0 0 0 5px color-mix(in srgb,var(--brand,#111) 12%,transparent)!important;
}
input[type="checkbox"],input[type="radio"]{
  width:22px!important;
  min-height:22px!important;
  height:22px!important;
  padding:0!important;
  accent-color:var(--brand,#111);
}

/* ---------- Buttons ---------- */
.btn,button{
  min-height:58px!important;
  padding:15px 22px!important;
  border:none;
  border-radius:16px!important;
  font-size:17px!important;
  line-height:1.1!important;
  font-weight:900!important;
  letter-spacing:-.015em;
  transition:transform .16s ease,box-shadow .16s ease,opacity .16s ease;
}
.btn:hover,button:hover{
  transform:translateY(-1px);
}
.btn:active,button:active{
  transform:scale(.985);
}
.primary{
  background:var(--brand,#111)!important;
  color:#fff!important;
  box-shadow:0 12px 30px color-mix(in srgb,var(--brand,#111) 24%,transparent)!important;
}
.secondary{
  background:#efefec!important;
  color:#111!important;
}
.outline,.danger{
  background:#fff!important;
  color:#111!important;
  border:1.5px solid #d3d3ce!important;
}
.actions{
  display:flex!important;
  flex-wrap:wrap!important;
  gap:12px!important;
  margin-top:18px!important;
}
.actions .btn,.actions button{
  min-width:170px;
}

/* ---------- Progress / steps ---------- */
.steps,.stepper,.progress-wrap{
  position:sticky!important;
  top:12px!important;
  z-index:40!important;
  margin-bottom:18px!important;
  padding:10px!important;
  border:1px solid rgba(0,0,0,.06)!important;
  border-radius:20px!important;
  background:rgba(255,255,255,.91)!important;
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  box-shadow:0 12px 34px rgba(0,0,0,.07)!important;
}

/* ---------- Status pills ---------- */
.status{
  display:inline-flex!important;
  align-items:center;
  min-height:34px;
  padding:8px 12px!important;
  border-radius:999px!important;
  background:#f0f0ed!important;
  color:#111!important;
  border:1px solid #dfdfda;
  font-size:13px!important;
  font-weight:900!important;
  white-space:nowrap;
}

/* ---------- Proof experience ---------- */
.proofhead{
  display:flex!important;
  align-items:flex-start!important;
  justify-content:space-between!important;
  gap:18px!important;
  margin-bottom:20px!important;
}
.viewer{
  width:100%!important;
  height:min(78vh,940px)!important;
  min-height:560px!important;
  border:1px solid var(--app-line)!important;
  border-radius:22px!important;
  background:#e9e9e6!important;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.45);
}
.approval{
  border:2px solid var(--brand,#111)!important;
  background:linear-gradient(180deg,#fff,#fafafa)!important;
}
.check{
  display:flex!important;
  gap:12px!important;
  align-items:flex-start!important;
  padding:14px 15px!important;
  border-radius:16px!important;
  background:#f6f6f4!important;
  font-size:15px!important;
  line-height:1.55!important;
}
#photoPanel{
  background:linear-gradient(180deg,#fff,#fbfbfa)!important;
}

/* ---------- Admin dashboard ---------- */
.results,.history{
  display:grid!important;
  gap:12px!important;
}
.result,.historyitem,.item{
  background:#fff!important;
  border:1px solid var(--app-line)!important;
  border-radius:18px!important;
  padding:18px!important;
  box-shadow:0 5px 18px rgba(0,0,0,.035)!important;
}
.result{
  cursor:pointer;
  transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease;
}
.result:hover{
  transform:translateY(-2px);
  border-color:#bdbdb8!important;
  box-shadow:0 12px 28px rgba(0,0,0,.07)!important;
}
.pass{
  display:inline-flex!important;
  align-items:center;
  min-height:64px;
  padding:14px 18px!important;
  border-radius:18px!important;
  background:#111!important;
  color:#fff!important;
  font-size:34px!important;
  font-weight:950!important;
  letter-spacing:.18em!important;
}

/* ---------- App nav ---------- */
.app-mobile-nav{
  display:none;
}

/* ---------- Install / welcome prompt ---------- */
.app-install-tip{
  display:none;
}
.app-experience-note{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  margin:0 0 18px;
  border-radius:18px;
  background:#111;
  color:#fff;
  box-shadow:0 10px 26px rgba(0,0,0,.12);
}
.app-experience-note .spark{
  width:38px;height:38px;
  display:grid;place-items:center;
  border-radius:13px;
  background:#fff;
  color:#111;
  font-weight:950;
}
.app-experience-note strong{
  display:block;
  font-size:15px;
}
.app-experience-note span{
  display:block;
  margin-top:2px;
  color:#d8d8d8;
  font-size:12px;
}

/* ---------- Success/error ---------- */
.ok{
  margin-top:12px!important;
  padding:13px 14px!important;
  border-radius:14px!important;
  background:#f0f7f3!important;
  color:#1e6a48!important;
  font-size:14px!important;
  font-weight:850!important;
}
.err{
  margin-top:12px!important;
  padding:13px 14px!important;
  border-radius:14px!important;
  background:#fff1f1!important;
  color:#a12626!important;
  font-size:14px!important;
  font-weight:850!important;
}
.hidden{display:none!important}

/* ==========================================================
   MOBILE APP MODE
   ========================================================== */
@media(max-width:768px){
  :root{--app-nav-h:82px}
  body{
    background:#f4f4f2!important;
    padding-bottom:calc(var(--app-nav-h) + var(--app-safe-bottom))!important;
    overscroll-behavior-y:none;
  }

  /* Hide large website header on phones. Use app bar instead. */
  .top,header.top{
    display:none!important;
  }
  .app-desktop-ribbon{
    display:none!important;
  }

  .app-mobile-topbar{
    position:sticky!important;
    top:0!important;
    z-index:90!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:12px!important;
    min-height:68px!important;
    padding:calc(10px + var(--app-safe-top)) 14px 10px!important;
    background:rgba(255,255,255,.94)!important;
    backdrop-filter:blur(18px)!important;
    -webkit-backdrop-filter:blur(18px)!important;
    border-bottom:1px solid rgba(0,0,0,.07)!important;
    box-shadow:0 8px 24px rgba(0,0,0,.04)!important;
  }
  .app-mobile-topbar .app-title{
    font-size:18px!important;
    font-weight:950!important;
    letter-spacing:-.025em!important;
  }
  .app-mobile-topbar .app-subtitle{
    margin-top:2px!important;
    color:#747874!important;
    font-size:11px!important;
    line-height:1.2!important;
  }
  .app-mobile-topbar .app-badge{
    width:44px!important;
    height:44px!important;
    border-radius:15px!important;
    background:var(--brand,#111)!important;
    color:#fff!important;
    font-size:13px!important;
    font-weight:950!important;
    box-shadow:0 8px 20px color-mix(in srgb,var(--brand,#111) 22%,transparent)!important;
  }

  main{
    width:100%!important;
    margin:0!important;
    padding:16px 12px 30px!important;
  }
  .card{
    padding:22px 17px!important;
    margin-bottom:14px!important;
    border-radius:24px!important;
    box-shadow:0 8px 26px rgba(0,0,0,.055)!important;
  }
  .panel{
    padding:18px!important;
    border-radius:21px!important;
  }

  h1{
    font-size:34px!important;
    line-height:1.03!important;
  }
  h2{
    font-size:26px!important;
  }
  h3{
    font-size:21px!important;
  }
  p,.lead{
    font-size:17px!important;
    line-height:1.58!important;
  }
  .small{
    font-size:14px!important;
  }
  label{
    font-size:15px!important;
  }

  input,textarea,select{
    min-height:60px!important;
    font-size:18px!important;
    border-radius:17px!important;
    padding:15px!important;
  }
  textarea{
    min-height:150px!important;
  }

  .btn,button{
    width:100%!important;
    min-height:62px!important;
    padding:16px 18px!important;
    border-radius:17px!important;
    font-size:18px!important;
  }
  .actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
  }

  .grid,.three,.two,.columns{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:14px!important;
  }

  .steps,.stepper,.progress-wrap{
    top:70px!important;
    margin:0 0 14px!important;
    border-radius:16px!important;
    padding:8px!important;
  }

  .proofhead{
    display:block!important;
  }
  .proofhead .status{
    margin-top:10px!important;
  }
  .viewer{
    height:58vh!important;
    min-height:430px!important;
    border-radius:18px!important;
  }

  .pass{
    width:100%!important;
    justify-content:center!important;
    font-size:32px!important;
  }

  .result,.historyitem,.item{
    padding:16px!important;
    border-radius:17px!important;
  }

  /* Bottom tab bar */
  .app-mobile-nav{
    position:fixed!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    z-index:120!important;
    height:calc(var(--app-nav-h) + var(--app-safe-bottom))!important;
    padding:8px 8px calc(8px + var(--app-safe-bottom))!important;
    display:grid!important;
    grid-template-columns:repeat(3,1fr)!important;
    background:rgba(255,255,255,.96)!important;
    backdrop-filter:blur(20px)!important;
    -webkit-backdrop-filter:blur(20px)!important;
    border-top:1px solid rgba(0,0,0,.08)!important;
    box-shadow:0 -14px 32px rgba(0,0,0,.08)!important;
  }
  .app-mobile-nav a{
    min-height:58px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:4px!important;
    border-radius:16px!important;
    text-decoration:none!important;
    color:#6d716d!important;
    font-size:11px!important;
    font-weight:850!important;
  }
  .app-mobile-nav a.active{
    color:var(--brand,#111)!important;
    background:color-mix(in srgb,var(--brand,#111) 8%,white)!important;
  }
  .app-mobile-nav .ico{
    font-size:21px!important;
    line-height:1!important;
  }

  .app-experience-note{
    border-radius:17px!important;
    padding:13px!important;
  }
}

@media(min-width:769px) and (max-width:1050px){
  main{width:min(calc(100% - 36px),980px)!important}
  .grid,.three{gap:14px!important}
}

@media(display-mode:standalone){
  body{user-select:none}
  input,textarea{user-select:text}
}

/* v8.2 EPiK full logo polish */
.epik-brand-hero{
  display:flex;
  align-items:center;
  justify-content:center;
  margin:0 0 20px;
}
.epik-brand-hero img{
  width:min(220px,52vw);
  height:auto;
  display:block;
  object-fit:contain;
}
.epik-admin-brand{
  display:flex;
  align-items:center;
  justify-content:center;
  margin:0 auto 18px;
}
.epik-admin-brand img{
  width:min(190px,48vw);
  height:auto;
  object-fit:contain;
  display:block;
}
.app-mobile-topbar .app-badge{
  padding:5px!important;
  background:#111!important;
}
.app-mobile-topbar .app-badge img{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
}
@media(max-width:768px){
  .epik-brand-hero{margin:2px 0 18px}
  .epik-brand-hero img{width:min(185px,56vw)}
  .epik-admin-brand img{width:min(170px,52vw)}
}
