/* ============================================================
   PanicHost portal shell, sidebar app chrome for the signed-in
   areas. Theme-aware: every colour is a token that flips on
   .dark-theme / .light-theme, matching the marketing site.
   ============================================================ */

.ph-shell {
  --ph-bg:        #f2f6fa;
  --ph-side:      #ffffff;
  --ph-surface:   #ffffff;
  --ph-surface-2: #f4f8fc;
  --ph-border:    #e2e9ee;
  --ph-text:      #0b0c1b;
  --ph-muted:     #5c5e70;
  --ph-primary:   #0060fe;
  --ph-accent:    #00d4ff;
  --ph-danger:    #d64541;
  --ph-shadow:    0 6px 24px rgba(11, 12, 27, .07);
  --ph-side-w:    258px;

  margin: 0;
  background: var(--ph-bg);
  color: var(--ph-text);
  min-height: 100vh;
}
.ph-shell.dark-theme {
  --ph-bg:        #0a0b12;
  --ph-side:      #10111c;
  --ph-surface:   #1a1b2e;
  --ph-surface-2: #212235;
  --ph-border:    #262842;
  --ph-text:      #eaf0f7;
  --ph-muted:     #9096a8;
  --ph-shadow:    0 8px 30px rgba(0, 0, 0, .4);
}

/* the marketing navbar/footer/preloader never belong in the app shell */
.ph-shell .theme-navbar,
.ph-shell .theme-footer,
.ph-shell .preloader { display: none !important; }

/* ---------------- sidebar ---------------- */
.ph-side {
  position: fixed; inset: 0 auto 0 0; width: var(--ph-side-w); z-index: 60;
  display: flex; flex-direction: column;
  background: var(--ph-side);
  border-right: 1px solid var(--ph-border);
  padding: 18px 14px;
  overflow-y: auto;
}
.ph-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: .3rem .5rem 1.2rem; text-decoration: none;
}
.ph-brand img { width: 34px; height: 34px; object-fit: contain; }
/* the white monogram vanishes on the light sidebar, swap per theme */
.ph-shell.dark-theme .ph-brand img.ph-only-dark { display: block; }
.ph-shell.dark-theme .ph-brand img.ph-only-light { display: none; }
.ph-shell:not(.dark-theme) .ph-brand img.ph-only-dark { display: none; }
.ph-shell:not(.dark-theme) .ph-brand img.ph-only-light { display: block; }
.ph-shell .ph-brand span {
  font-family: var(--primary-font, inherit); font-weight: 800;
  font-size: 1.22rem; color: var(--ph-text); letter-spacing: .2px;
}
.ph-brand span i {
  display: block; font-style: normal; font-size: .62rem; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--ph-primary); margin-top: -2px;
}

.ph-nav { flex: 1; }
.ph-nav-group {
  margin: 1.1rem .7rem .45rem; font-size: .66rem; font-weight: 800;
  letter-spacing: 1.3px; text-transform: uppercase; color: var(--ph-muted); opacity: .75;
}
.ph-nav-group:first-child { margin-top: 0; }
.ph-shell .ph-side .ph-nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .58rem .7rem; margin-bottom: 2px; border-radius: 10px;
  color: var(--ph-muted); font-size: .875rem; font-weight: 600;
  text-decoration: none !important; transition: background .15s ease, color .15s ease;
}
.ph-nav-item .ph-i { flex: 0 0 auto; opacity: .9; }
.ph-nav-item span { flex: 1; }
.ph-shell .ph-side .ph-nav-item:hover { background: var(--ph-surface-2); color: var(--ph-text); }
.ph-shell .ph-side .ph-nav-item.on {
  background: linear-gradient(135deg, var(--ph-primary), #3d8bff);
  color: #fff; box-shadow: 0 4px 14px rgba(0, 96, 254, .32);
}
.ph-nav-item.on .ph-i { opacity: 1; }

.ph-pill {
  font-style: normal; font-size: .68rem; font-weight: 800; line-height: 1;
  padding: .25rem .45rem; border-radius: 999px;
  background: var(--ph-surface-2); color: var(--ph-muted);
  min-width: 20px; text-align: center;
}
.ph-nav-item.on .ph-pill { background: rgba(255, 255, 255, .22); color: #fff; }
.ph-pill.warn { background: rgba(214, 69, 65, .16); color: var(--ph-danger); }

.ph-side-card {
  margin-top: 1.2rem; padding: .95rem 1rem; border-radius: 14px;
  background: var(--ph-surface-2); border: 1px solid var(--ph-border);
}
.ph-side-card strong {
  display: flex; align-items: center; gap: .4rem;
  font-size: .82rem; color: var(--ph-text);
}
.ph-side-card p { margin: .4rem 0 .7rem; font-size: .76rem; color: var(--ph-muted); line-height: 1.5; }
.ph-side-cta {
  display: inline-block; padding: .4rem .8rem; border-radius: 8px;
  background: var(--ph-primary); color: #fff !important;
  font-size: .76rem; font-weight: 700; text-decoration: none !important;
}

/* ---------------- main column ---------------- */
.ph-main { margin-left: var(--ph-side-w); min-height: 100vh; display: flex; flex-direction: column; }

.ph-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: 14px 26px; background: var(--ph-side);
  border-bottom: 1px solid var(--ph-border);
}
.ph-top-title { flex: 1; min-width: 0; }
.ph-top-title h1 { margin: 0; font-size: 1.22rem; font-weight: 800; color: var(--ph-text); }
.ph-top-title p { margin: .1rem 0 0; font-size: .8rem; color: var(--ph-muted); }
.ph-top-actions { display: flex; align-items: center; gap: .5rem; }

.ph-icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: var(--ph-surface-2); border: 1px solid var(--ph-border); color: var(--ph-muted);
  transition: color .15s ease, border-color .15s ease;
}
.ph-icon-btn:hover { color: var(--ph-text); border-color: var(--ph-primary); }
.ph-dot {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; background: var(--ph-danger); color: #fff;
  font-size: .63rem; font-weight: 800; font-style: normal;
  display: flex; align-items: center; justify-content: center;
}
.ph-burger { display: none; }

.ph-shell.dark-theme .ph-only-dark { display: inline-flex; }
.ph-shell.dark-theme .ph-only-light { display: none; }
.ph-shell:not(.dark-theme) .ph-only-dark { display: none; }
.ph-shell:not(.dark-theme) .ph-only-light { display: inline-flex; }

.ph-user {
  display: flex; align-items: center; gap: .6rem; cursor: pointer;
  padding: .3rem .6rem .3rem .3rem; border-radius: 999px;
  background: var(--ph-surface-2); border: 1px solid var(--ph-border); color: var(--ph-muted);
}
.ph-user:hover { border-color: var(--ph-primary); }
.ph-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--ph-primary), var(--ph-accent));
  color: #fff; font-weight: 800; font-size: .8rem;
}
.ph-user-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.ph-user-text strong {
  font-size: .82rem; color: var(--ph-text); max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ph-user-text i { font-style: normal; font-size: .68rem; color: var(--ph-muted); }

/* ---------------- popovers ---------------- */
.ph-menu { position: relative; }
.ph-pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 310px; z-index: 70;
  background: var(--ph-surface); border: 1px solid var(--ph-border);
  border-radius: 14px; box-shadow: var(--ph-shadow); padding: .5rem;
}
.ph-pop-sm { width: 220px; }
.ph-pop-head {
  margin: .3rem .6rem .5rem; font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px; color: var(--ph-muted);
}
.ph-pop-empty { margin: .6rem; font-size: .82rem; color: var(--ph-muted); }
.ph-pop-row { display: block; padding: .55rem .6rem; border-radius: 9px; text-decoration: none !important; }
.ph-pop-row:hover { background: var(--ph-surface-2); }
.ph-shell .ph-pop-row strong { display: block; font-size: .82rem; color: var(--ph-text); }
.ph-pop-row span {
  display: block; font-size: .76rem; color: var(--ph-muted); margin: .1rem 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ph-pop-row i { font-style: normal; font-size: .68rem; color: var(--ph-muted); opacity: .7; }
.ph-shell .ph-pop-item {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .55rem .6rem; border-radius: 9px; border: 0; background: none; cursor: pointer;
  font-size: .84rem; font-weight: 600; color: var(--ph-text);
  text-decoration: none !important; text-align: left;
}
.ph-pop-item:hover { background: var(--ph-surface-2); }
.ph-pop-danger { color: var(--ph-danger); }

/* ---------------- content ---------------- */
.ph-content { flex: 1; padding: 26px; }
/* views were written for the marketing shell, neutralise its spacing here */
.ph-content .portal-main { padding: 0 !important; min-height: 0 !important; }
.ph-content .container {
  width: 100% !important; max-width: none !important;
  padding-left: 0 !important; padding-right: 0 !important;
}
.ph-content .pm-header { margin-bottom: 1.3rem; }
/* the sidebar replaces the old admin button-row nav (filter rows,
   which reuse .admin-nav, must stay visible) */
.ph-content .ph-legacy-nav { display: none; }
/* in-page H1 becomes a section label under the shell title */
.ph-content .pm-header > div:first-child > .title-1 { font-size: 1.35rem; }

/* ---------------- responsive ---------------- */
@media (max-width: 1024px) {
  .ph-side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--ph-shadow); }
  .ph-shell.ph-open .ph-side { transform: none; }
  .ph-main { margin-left: 0; }
  .ph-burger { display: inline-flex; }
  .ph-side-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .5); }
}
@media (max-width: 640px) {
  .ph-content { padding: 16px; }
  .ph-top { padding: 12px 16px; }
  .ph-user-text { display: none; }
  .ph-pop { width: min(310px, calc(100vw - 32px)); }
}

/* ==========================================================================
   Staff "view as customer"
   Deliberately loud. Staff inside a customer's account are one click from
   rebuilding a live server, so the state must be impossible to lose track of.
   ========================================================================== */
.ph-imp { position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .6rem 1.25rem; font-size: .88rem;
  color: #fff; background: #b45309;
  border-bottom: 1px solid rgba(0,0,0,.25); }
.ph-imp p { margin: 0; }
.ph-imp strong { font-weight: 700; }
.ph-imp form { margin: 0 0 0 auto; }
.ph-imp-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.3); flex: none;
  animation: ph-imp-pulse 2s ease-in-out infinite; }
@keyframes ph-imp-pulse { 50% { box-shadow: 0 0 0 6px rgba(255,255,255,.12); } }
.ph-imp-exit { cursor: pointer; white-space: nowrap;
  padding: .3rem .8rem; border-radius: 8px; font-size: .82rem; font-weight: 600;
  color: #b45309; background: #fff; border: 0; }
.ph-imp-exit:hover { filter: brightness(.94); }
@media (prefers-reduced-motion: reduce) { .ph-imp-dot { animation: none; } }

/* Guest shopping in the portal shell: sign-in pair instead of an account menu. */
.ph-guest-btn { white-space: nowrap; }
