*{box-sizing:border-box}

:root{
  --orange-primary:#E67E22;
  --orange-primary-dark:#D35400;
  --orange-accent:#F39C12;
  --orange-bg:#FFF8F1;
  --orange-bg-soft:#FFF3E8;
  --orange-border:#F1DCC8;
  --orange-border-strong:#EDC9A6;
  --orange-text:#4A2A12;
  --orange-muted:#7A5A43;
  --orange-white:#ffffff;
  --orange-shadow:0 10px 24px rgba(230,126,34,.12);
}

*{box-sizing:border-box}

html,body{
  margin:0;
  padding:0;
  max-width:100%;
  overflow-x:hidden;
}

html{
  -webkit-text-size-adjust:100%;
}

body{
  font-family:system-ui,-apple-system,Segoe UI,sans-serif;
  background:var(--orange-bg);
  color:var(--orange-text);
}

a{
  text-decoration:none;
  color:inherit;
}

button{
  font-family:inherit;
}

.topbar{
  position:sticky;
  top:0;
  z-index:1000;
  background:linear-gradient(135deg,var(--orange-primary),var(--orange-primary-dark));
  color:#fff;
  box-shadow:0 4px 14px rgba(230,126,34,.18);
}

.topbar-main{
  min-height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 14px;
}

@media (max-width:768px){
  .topbar-main{
    min-height:54px;
    padding:0 12px;
  }
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  font-size:18px;
  min-width:0;
}

.brand span{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-shrink:0;
}

.header-login-link{
  color:#fff;
  font-size:14px;
  font-weight:800;
  padding:8px 12px;
  border-radius:12px;
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.18);
}

.header-profile img{
  width:36px;
  height:36px;
  border-radius:50%;
  object-fit:cover;
  border:2px solid #FFD7B0;
  display:block;
  background:#fff;
}

.menu-btn{
  background:none;
  border:0;
  color:#fff;
  font-size:22px;
  cursor:pointer;
  padding:4px 8px;
  -webkit-tap-highlight-color:transparent;
}

.bell-btn{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border-radius:50%;
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.12);
}

.bell-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  font-size:21px;
  color:#fff;
  opacity:.92;
  transition:transform .2s ease,color .2s ease,opacity .2s ease;
}

.bell-icon.active{
  color:#22c55e;
  opacity:1;
  transform:scale(1.08);
}

.bell-btn.active{
  background:rgba(25,193,95,.18);
  box-shadow:0 0 0 2px rgba(25,193,95,.22) inset;
}

.bell-status{
  position:absolute;
  top:6px;
  right:6px;
  width:12px;
  height:12px;
  border-radius:50%;
  border:2px solid var(--orange-primary-dark);
  box-shadow:0 0 0 1px rgba(255,255,255,.15);
}

.bell-on{background:#19c15f}
.bell-off{background:#e53935}
.bell-default{background:#f59e0b}

body.drawer-open{
  overflow:hidden;
}

.drawer-overlay{
  position:fixed;
  inset:0;
  background:rgba(74,42,18,.34);
  opacity:0;
  visibility:hidden;
  transition:opacity .25s ease, visibility .25s ease;
  z-index:1999;
  will-change:opacity;
}

.drawer-overlay.show{
  opacity:1;
  visibility:visible;
}

.drawer{
  position:fixed;
  top:0;
  right:0;
  width:78%;
  max-width:360px;
  height:100dvh;
  max-height:100dvh;
  background:linear-gradient(180deg,#FFF8F1 0%, #FFFFFF 100%);
  z-index:2000;
  border-radius:18px 0 0 18px;
  box-shadow:-10px 0 30px rgba(230,126,34,.14);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  transform:translateX(100%);
  transition:transform .25s ease;
  will-change:transform;
  overscroll-behavior:contain;
}

.drawer.show{
  transform:translateX(0);
}

.drawer-head{
  flex:0 0 auto;
  padding:calc(14px + env(safe-area-inset-top)) 16px 14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:var(--orange-bg-soft);
  color:var(--orange-primary-dark);
  font-weight:800;
  font-size:22px;
  position:sticky;
  top:0;
  z-index:2;
  border-bottom:1px solid var(--orange-border);
}

.drawer-head button{
  border:1px solid var(--orange-border-strong);
  background:#fff;
  color:var(--orange-primary-dark);
  border-radius:10px;
  width:38px;
  height:38px;
  cursor:pointer;
  font-size:18px;
  -webkit-tap-highlight-color:transparent;
}

.drawer-body{
  flex:1 1 auto;
  min-height:0;
  padding:14px 14px calc(110px + env(safe-area-inset-bottom));
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}

.drawer-btn{
  display:block;
  width:100%;
  padding:12px 14px;
  margin-bottom:10px;
  border:1px solid var(--orange-border);
  border-radius:14px;
  background:#fff;
  color:var(--orange-text);
  font-weight:700;
  font-size:15px;
  line-height:1.35;
  text-align:left;
  cursor:pointer;
  touch-action:pan-y;
  -webkit-tap-highlight-color:transparent;
  box-shadow:0 2px 8px rgba(230,126,34,.05);
}

.drawer-btn:last-child{
  margin-bottom:20px;
}

.container{
  max-width:1100px;
  margin:auto;
  padding:12px;
}

#pushPopup{
  position:fixed;
  inset:0;
  background:rgba(74,42,18,.34);
  z-index:99999;
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  overflow:auto;
}

#pushPopup.active{
  display:flex;
}

.drawer[hidden],
.drawer-overlay[hidden],
#pushPopup[hidden]{
  display:none !important;
}

.push-modal{
  width:100%;
  max-width:420px;
  max-height:90dvh;
  overflow-y:auto;
  background:#fffaf5;
  border:1px solid var(--orange-border);
  border-radius:18px;
  padding:20px;
  box-shadow:0 10px 30px rgba(230,126,34,.18);
  text-align:left;
  color:var(--orange-text);
}

#categoryCheckboxWrap{
  display:grid;
  gap:12px;
}

.push-cat-row{
  display:grid;
  grid-template-columns:26px 1fr;
  align-items:center;
  gap:12px;
  color:var(--orange-text);
  font-size:16px;
  font-weight:700;
  line-height:1.35;
}

.push-cat-row input[type="checkbox"]{
  width:20px;
  height:20px;
  margin:0;
  accent-color:var(--orange-primary);
  cursor:pointer;
}

.push-cat-text{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--orange-text);
  word-break:break-word;
}

#pushDeniedMsg,
#pushStatusMsg{
  display:none;
  margin:12px 0 0;
  font-size:14px;
  text-align:center;
  line-height:1.5;
}

#pushDeniedMsg{color:#c62828}
#pushStatusMsg{color:#177a35}

.push-progress-wrap{
  margin-top:14px;
}

.push-progress-text{
  font-size:14px;
  color:var(--orange-primary-dark);
  margin-bottom:8px;
  text-align:left;
}

.push-progress-bar{
  width:100%;
  height:10px;
  background:#F8E9DB;
  border-radius:999px;
  overflow:hidden;
  position:relative;
}

.push-progress-fill{
  position:absolute;
  top:0;
  left:0;
  width:35%;
  height:100%;
  background:linear-gradient(135deg,var(--orange-accent),var(--orange-primary));
  border-radius:999px;
  animation:pushLoadingBar 1.1s linear infinite;
}

@keyframes pushLoadingBar{
  0%{left:-35%}
  100%{left:100%}
}

/* =========================
   GLOBAL FORM LOADER
========================= */

.global-form-loader{
  position:fixed;
  inset:0;
  width:100vw;
  height:100dvh;
  min-height:100vh;
  background:rgba(255,248,241,.88);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:100000;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .18s ease, visibility .18s ease;
}

.global-form-loader.show{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}

.loader-box{
  background:#fffaf5;
  padding:22px 26px;
  border-radius:18px;
  border:1px solid var(--orange-border);
  box-shadow:0 10px 30px rgba(230,126,34,.12);
  text-align:center;
  min-width:180px;
  max-width:min(92vw, 300px);
}

.loader-spinner{
  width:46px;
  height:46px;
  border:4px solid #F1DCC8;
  border-top:4px solid var(--orange-primary);
  border-radius:50%;
  margin:0 auto 12px;
  animation:spin .8s linear infinite;
}

.loader-text{
  font-size:15px;
  font-weight:700;
  color:var(--orange-primary-dark);
  line-height:1.4;
}

body.form-loading{
  overflow:hidden;
}

@keyframes spin{
  100%{transform:rotate(360deg)}
}

.field-error{
  min-height:18px;
  margin-top:4px;
  margin-bottom:6px;
  font-size:13px;
  color:#dc2626;
  font-weight:700;
}

.input-error{
  border-color:#dc2626 !important;
  background:#fff6f6;
}

.input-error:focus{
  border-color:#dc2626;
  box-shadow:0 0 0 3px rgba(220,38,38,.12);
}

/* =========================
   STARTUP LOADER
========================= */

.app-startup-loader{
  position:fixed;
  inset:0;
  width:100vw;
  height:100dvh;
  min-height:100vh;
  background:rgba(255,248,241,.84);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:999999;
  opacity:1;
  visibility:visible;
  transition:opacity .4s ease, visibility .4s ease;
}

.app-startup-loader.hide{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}

.app-startup-inner{
  position:relative;
  width:min(92vw, 240px);
  height:255px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  margin:0 auto;
}

.app-startup-ring{
  position:absolute;
  top:8px;
  left:50%;
  transform:translateX(-50%);
  width:188px;
  height:188px;
  border-radius:50%;
  border:4px solid rgba(230,126,34,.14);
  border-top-color:var(--orange-primary);
  border-right-color:rgba(230,126,34,.35);
  animation:rrAppSpin 1.05s linear infinite;
  box-shadow:0 0 0 6px rgba(230,126,34,.03);
  will-change:transform;
}

.app-startup-logo{
  position:absolute;
  top:62px;
  left:50%;
  transform:translateX(-50%);
  width:76px;
  height:76px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.app-startup-logo img{
  width:76px;
  height:76px;
  object-fit:contain;
  display:block;
  filter:drop-shadow(0 6px 14px rgba(230,126,34,.14));
}

.app-startup-text{
  position:absolute;
  bottom:34px;
  left:50%;
  transform:translateX(-50%);
  width:min(92vw, 230px);
  font-size:15px;
  line-height:1.35;
  font-weight:800;
  color:var(--orange-primary-dark);
  letter-spacing:.2px;
  margin:0;
}

.app-startup-subtext{
  position:absolute;
  bottom:8px;
  left:50%;
  transform:translateX(-50%);
  width:min(92vw, 230px);
  font-size:12px;
  line-height:1.4;
  font-weight:600;
  color:var(--orange-muted);
  opacity:.92;
  margin:0;
}

@keyframes rrAppSpin{
  0%{
    transform:translateX(-50%) rotate(0deg);
  }
  100%{
    transform:translateX(-50%) rotate(360deg);
  }
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width:480px){
  .drawer{
    width:84%;
  }

  .push-modal{
    padding:18px 16px;
    border-radius:16px;
  }

  .global-form-loader{
    padding:12px;
  }

  .loader-box{
    min-width:unset;
    width:min(92vw, 280px);
    padding:18px 16px;
    border-radius:16px;
  }

  .loader-spinner{
    width:42px;
    height:42px;
  }

  .loader-text{
    font-size:14px;
  }

  .app-startup-loader{
    padding:12px;
  }

  .app-startup-inner{
    width:min(94vw, 220px);
    height:240px;
  }

  .app-startup-ring{
    top:10px;
    width:168px;
    height:168px;
    border-width:4px;
  }

  .app-startup-logo{
    top:60px;
    width:68px;
    height:68px;
  }

  .app-startup-logo img{
    width:68px;
    height:68px;
  }

  .app-startup-text{
    bottom:34px;
    width:min(92vw, 210px);
    font-size:14px;
  }

  .app-startup-subtext{
    bottom:10px;
    width:min(92vw, 210px);
    font-size:12px;
  }
}