/* ==========================================================================
   SIM PKK — PWA APP EXPERIENCE v1.0.0
   Additive only: does not replace existing responsive layout.
   ========================================================================== */

:root{
  --pwa-blue:#ee4d2d;
  --pwa-blue-2:#f7613f;
  --pwa-blue-soft:#f7e7dd;
  --pwa-ink:#3c2818;
  --pwa-muted:#7a6250;
  --pwa-line:#e3cfba;
}

[hidden]{display:none!important}

/* ---------- Front homepage install card ---------- */
.pwa-install-card{
  position:relative;
  isolation:isolate;
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:20px;
  margin-top:20px;
  margin-bottom:18px;
  padding:22px 24px;
  overflow:hidden;
  border:1px solid rgba(238,77,45,.18);
  border-radius:24px;
  background:
    radial-gradient(circle at 0 0,rgba(255,255,255,.92),transparent 25%),
    radial-gradient(circle at 100% 100%,rgba(238,77,45,.09),transparent 35%),
    linear-gradient(135deg,#fbf4eb 0%,#f7e7dd 48%,#f5e9dc 100%);
  box-shadow:0 18px 42px rgba(95,58,29,.08);
}
.pwa-install-card::after{
  content:"";
  position:absolute;
  z-index:-1;
  width:180px;
  height:180px;
  right:-72px;
  top:-88px;
  border:26px solid rgba(238,77,45,.05);
  border-radius:50%;
}
.pwa-install-icon{
  width:78px;
  height:78px;
  display:grid;
  place-items:center;
  flex:0 0 78px;
  overflow:hidden;
  border:1px solid rgba(238,77,45,.15);
  border-radius:22px;
  background:#fff;
  box-shadow:0 12px 28px rgba(95,58,29,.10),inset 0 1px 0 #fff;
}
.pwa-install-icon img{display:block;width:100%;height:100%;object-fit:cover}
.pwa-install-copy{min-width:0}
.pwa-install-kicker{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  margin-bottom:6px;
  padding:0 9px;
  border-radius:999px;
  background:#f7e7dd;
  color:#d84323;
  font-size:9px;
  font-weight:900;
  letter-spacing:.10em;
}
.pwa-install-copy h2{
  margin:0;
  color:var(--pwa-ink);
  font-size:clamp(22px,2.6vw,32px);
  line-height:1.05;
  letter-spacing:-.035em;
}
.pwa-install-copy p{
  max-width:720px;
  margin:7px 0 0;
  color:var(--pwa-muted);
  font-size:12px;
  line-height:1.55;
}
.pwa-install-points{
  display:flex;
  flex-wrap:wrap;
  gap:6px 12px;
  margin-top:10px;
  color:#7a6250;
  font-size:9px;
  font-weight:750;
}
.pwa-install-points span{display:inline-flex;align-items:center;gap:5px}
.pwa-install-points i{
  display:grid;
  place-items:center;
  width:15px;
  height:15px;
  border-radius:50%;
  background:#f5dfd6;
  color:#d84323;
  font-size:8px;
  font-style:normal;
}
.pwa-install-action{display:flex;align-items:center;justify-content:flex-end}
.pwa-install-button{
  appearance:none;
  border:0;
  cursor:pointer;
  min-width:190px;
  display:flex!important;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px 16px!important;
  border-radius:15px!important;
  background:linear-gradient(135deg,#f7613f,#ee4d2d)!important;
  color:#fff!important;
  box-shadow:0 11px 23px rgba(238,77,45,.23)!important;
}
.pwa-install-button:hover{transform:translateY(-1px)}
.pwa-install-button-icon{
  display:grid;
  place-items:center;
  width:30px;
  height:30px;
  flex:0 0 30px;
  border:1px solid rgba(255,255,255,.25);
  border-radius:10px;
  background:rgba(255,255,255,.12);
  font-size:16px;
  font-weight:900;
}
.pwa-install-button>span:last-child{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:1px;
}
.pwa-install-button strong{font-size:11px;line-height:1.2}
.pwa-install-button small{font-size:7.5px;font-weight:650;opacity:.82;line-height:1.2}

/* ---------- Install help bottom sheet ---------- */
body.pwa-guide-open{overflow:hidden!important}
.pwa-install-guide{
  position:fixed;
  inset:0;
  z-index:1000000;
}
.pwa-install-guide-backdrop{
  position:absolute;
  inset:0;
  background:rgba(49,31,20,.62);
  backdrop-filter:blur(7px);
  -webkit-backdrop-filter:blur(7px);
}
.pwa-install-guide-sheet{
  position:absolute;
  left:50%;
  bottom:0;
  width:min(520px,100%);
  max-height:min(88dvh,700px);
  overflow:auto;
  transform:translateX(-50%);
  padding:12px 20px calc(20px + env(safe-area-inset-bottom));
  border:1px solid rgba(227,207,186,.85);
  border-bottom:0;
  border-radius:28px 28px 0 0;
  background:
    radial-gradient(circle at 100% 0,rgba(238,77,45,.10),transparent 32%),
    #fff;
  box-shadow:0 -25px 70px rgba(74,42,24,.22);
}
.pwa-guide-handle{
  width:44px;
  height:5px;
  margin:0 auto 13px;
  border-radius:999px;
  background:#d9c6b3;
}
.pwa-guide-close{
  position:absolute;
  right:16px;
  top:16px;
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border:1px solid #e3cfba;
  border-radius:11px;
  background:#fbf4eb;
  color:#5f4838;
  font-size:21px;
  line-height:1;
  cursor:pointer;
}
.pwa-guide-app{
  display:flex;
  align-items:center;
  gap:12px;
  padding-right:42px;
}
.pwa-guide-app img{
  width:56px;
  height:56px;
  border-radius:16px;
  box-shadow:0 8px 18px rgba(95,58,29,.12);
}
.pwa-guide-app small{
  display:block;
  margin-bottom:3px;
  color:#d84323;
  font-size:8px;
  font-weight:900;
  letter-spacing:.1em;
}
.pwa-guide-app h3{
  margin:0;
  color:#3c2818;
  font-size:20px;
  line-height:1.1;
}
.pwa-guide-ios>p,.pwa-guide-generic>p{
  margin:18px 0 10px;
  color:#7a6250;
  font-size:11px;
  line-height:1.5;
}
.pwa-install-guide ol{
  list-style:none;
  display:grid;
  gap:8px;
  margin:0;
  padding:0;
}
.pwa-install-guide li{
  display:grid;
  grid-template-columns:30px minmax(0,1fr);
  align-items:center;
  gap:10px;
  padding:10px 11px;
  border:1px solid #e3cfba;
  border-radius:13px;
  background:#fbf4eb;
  color:#5f4838;
  font-size:11px;
  line-height:1.4;
}
.pwa-install-guide li>span{
  display:grid;
  place-items:center;
  width:30px;
  height:30px;
  border-radius:10px;
  background:linear-gradient(135deg,#f9e7dd,#f3ddd2);
  color:#d84323;
  font-size:11px;
  font-weight:900;
}
.pwa-share-symbol{
  display:inline-grid;
  place-items:center;
  width:24px;
  height:24px;
  margin-left:3px;
  border-radius:7px;
  background:#f7e7dd;
  color:#ee4d2d;
  font-size:16px;
}
.pwa-guide-done{
  width:100%;
  min-height:44px;
  margin-top:13px;
  border:0;
  border-radius:13px;
  background:linear-gradient(135deg,#f7613f,#ee4d2d);
  color:#fff;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
}

/* ---------- Installed / standalone app mode ---------- */
html.pwa-standalone{
  min-height:100%;
  background:#efe3d3;
}
html.pwa-standalone body{
  min-height:100dvh;
  overscroll-behavior-y:auto;
  -webkit-tap-highlight-color:transparent;
  padding-top:env(safe-area-inset-top);
  padding-left:env(safe-area-inset-left);
  padding-right:env(safe-area-inset-right);
}
html.pwa-standalone [data-pwa-install-card]{
  display:none!important;
}

/* Public frontend feels like an app once installed */
html.pwa-standalone .topline{display:none!important}
html.pwa-standalone .header{
  position:sticky;
  top:0;
  z-index:1000;
  background:rgba(255,255,255,.93);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
}
html.pwa-standalone footer{
  padding-bottom:calc(18px + env(safe-area-inset-bottom));
}

/* Admin/auth: preserve current responsive system, only honor device safe areas. */
html.pwa-standalone .main-wrapper{min-height:100dvh}
html.pwa-standalone .main-content{
  padding-bottom:calc(86px + env(safe-area-inset-bottom))!important;
}
html.pwa-standalone .mobile-bottom-nav,
html.pwa-standalone [class*="bottom-nav"]{
  padding-bottom:env(safe-area-inset-bottom)!important;
}

/* ---------- Mobile ---------- */
@media(max-width:760px){
  .pwa-install-card{
    grid-template-columns:52px minmax(0,1fr);
    gap:10px 12px;
    margin-top:12px;
    margin-bottom:12px;
    padding:14px;
    border-radius:19px;
  }
  .pwa-install-icon{
    width:52px;
    height:52px;
    flex-basis:52px;
    border-radius:15px;
  }
  .pwa-install-copy h2{
    font-size:19px;
  }
  .pwa-install-copy p{
    font-size:9.5px;
    line-height:1.45;
  }
  .pwa-install-kicker{
    min-height:20px;
    margin-bottom:4px;
    padding:0 7px;
    font-size:6.8px;
  }
  .pwa-install-points{
    grid-column:1 / -1;
    gap:5px 8px;
    font-size:7px;
  }
  .pwa-install-action{
    grid-column:1 / -1;
    width:100%;
  }
  .pwa-install-button{
    width:100%!important;
    min-width:0;
    min-height:46px;
    border-radius:13px!important;
  }
  .pwa-install-button>span:last-child{
    align-items:center;
  }
  .pwa-install-guide-sheet{
    padding-left:15px;
    padding-right:15px;
  }
}

@media(max-width:390px){
  .pwa-install-card{
    grid-template-columns:44px minmax(0,1fr);
    padding:12px;
  }
  .pwa-install-icon{
    width:44px;
    height:44px;
    flex-basis:44px;
    border-radius:13px;
  }
  .pwa-install-copy h2{font-size:17px}
  .pwa-install-copy p{font-size:8.8px}
  .pwa-install-points{
    display:grid;
    grid-template-columns:1fr;
  }
}

/* PWA v10.20 - maintenance action on public homepage (no fixed overlay). */
.pwa-repair-button {
  display: block; width: 100%; margin-top: .65rem; padding: .65rem .85rem;
  border: 1px solid rgba(125, 93, 66, .35); background: transparent;
  color: #6b4430; border-radius: 12px; font: inherit; font-size: .83rem;
  line-height: 1.4; font-weight: 600; cursor: pointer; white-space: normal;
}
.pwa-repair-button:hover, .pwa-repair-button:focus-visible {
  background: rgba(238, 77, 45, .07); outline-offset: 2px;
}
.pwa-repair-button:disabled { opacity: .65; cursor: wait; }
.pwa-repair-status { display: block; max-width: 280px; margin-top: .5rem; font-size: .8rem; line-height: 1.5; color: #644735; }
.pwa-repair-status[hidden] { display: none !important; }

.nr-pwa-repair-panel { margin-top: .45rem; margin-bottom: 1.2rem; }
.nr-pwa-repair-panel .pwa-repair-button { width: auto; max-width: 100%; margin-top: .35rem; }
.nr-pwa-repair-note { display: block; margin-top: .4rem; color: #715b4d; line-height: 1.45; }
