/* Independent Clean Premium header — no dependency on the legacy h_header */
.sgp-header {
  --sgp-bg:var(--sg-header-bg,#111827);
  --sgp-panel:var(--sg-surface,#171d2b);
  --sgp-text:var(--sg-text,#edf0fa);
  --sgp-muted:var(--sg-muted,#9aa4b8);
  --sgp-border:var(--sg-border,rgba(255,255,255,.1));
  --sgp-accent:#5368e8;
  position:relative; z-index:1050; width:100%;
  color:var(--sgp-text); background:var(--sgp-bg);
  border-bottom:1px solid var(--sgp-border);
  box-shadow:0 8px 26px rgba(0,0,0,.12);
}
.sgp-header * { box-sizing:border-box; }
.sgp-header__inner {
  width:min(100% - 32px,1740px); min-height:72px; margin:0 auto;
  display:flex; align-items:center; gap:clamp(14px,2vw,30px);
}
.sgp-brand { display:flex; align-items:center; gap:11px; flex:0 0 auto; color:var(--sgp-text); text-decoration:none; }
.sgp-brand:hover { color:var(--sgp-text); text-decoration:none; }
.sgp-brand__mark { width:31px;height:31px;display:grid;grid-template-columns:repeat(2,1fr);gap:3px;transform:rotate(-8deg); }
.sgp-brand__mark span { border-radius:4px;background:var(--sgp-accent); }
.sgp-brand__mark span:nth-child(2),.sgp-brand__mark span:nth-child(3) { opacity:.62; }
.sgp-brand__word { font-size:1.17rem;font-weight:850;letter-spacing:-.045em;white-space:nowrap; }
.sgp-brand__word span { color:#8d9aff; }
.sgp-navigation { display:flex;align-items:center;gap:5px;flex:1;min-width:0; }
.sgp-navigation a,.sgp-nav-group summary {
  display:flex;align-items:center;min-height:40px;padding:0 12px;border:0;border-radius:9px;
  color:var(--sgp-muted);font-size:.86rem;font-weight:650;text-decoration:none;white-space:nowrap;cursor:pointer;
  list-style:none;transition:background .18s ease,color .18s ease;
}
.sgp-navigation a:hover,.sgp-nav-group summary:hover,.sgp-nav-group[open] summary {
  color:var(--sgp-text);background:rgba(128,145,255,.1);text-decoration:none;
}
.sgp-nav-group { position:relative; }
.sgp-nav-group summary::-webkit-details-marker { display:none; }
.sgp-nav-group summary::after { content:"";width:6px;height:6px;margin:0 0 3px 9px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg); }
.sgp-dropdown {
  position:absolute;top:calc(100% + 9px);left:0;z-index:20;min-width:220px;max-height:min(72vh,620px);overflow:auto;
  padding:7px;background:var(--sgp-panel);border:1px solid var(--sgp-border);border-radius:13px;
  box-shadow:0 18px 45px rgba(0,0,0,.28);
}
.sgp-dropdown a,.sgp-dropdown .sgp-menu-action {
  width:100%;min-height:36px;padding:8px 10px;display:flex;justify-content:space-between;align-items:center;
  color:var(--sgp-text);font-size:.82rem;font-weight:550;border-radius:7px;text-align:left;
}
.sgp-dropdown a:hover,.sgp-dropdown .sgp-menu-action:hover { background:rgba(128,145,255,.12); }
.sgp-dropdown .sgp-sub-link { padding-left:24px;color:var(--sgp-muted);font-size:.78rem; }
.sgp-dropdown .sgp-menu-action { border:0;background:transparent;cursor:pointer; }
.sgp-dropdown .sgp-menu-action span { color:var(--sgp-muted);font-size:.72rem; }
.sgp-dropdown-divider { display:block;height:1px;margin:6px 4px;background:var(--sgp-border); }
.sgp-dropdown-note { display:block;padding:8px 10px;color:var(--sgp-muted);font-size:.75rem;line-height:1.45; }
.sgp-nav-danger { color:#f28b91!important; }
.sgp-header-tools { display:flex;align-items:center;gap:9px;flex:0 0 auto;margin-left:auto; }
.sgp-icon-button {
  position:relative;width:39px;height:39px;display:grid;place-items:center;border:1px solid var(--sgp-border);
  border-radius:11px;background:rgba(255,255,255,.035);color:var(--sgp-text);text-decoration:none;cursor:pointer;
}
.sgp-icon-button:hover { color:var(--sgp-text);background:rgba(128,145,255,.12);text-decoration:none; }
.sgp-icon-button svg { width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round; }
.sgp-theme-sun,.sgp-theme-moon { font-size:1.25rem;line-height:1; }
.sgp-theme-moon { display:none; }
.sgp-notification-count { position:absolute;top:-5px;right:-5px;min-width:17px;height:17px;padding:0 4px;border-radius:99px;background:#e65d73;color:#fff;font-size:.65rem;font-weight:800;display:grid;place-items:center; }
.sgp-user-chip { display:flex;align-items:center;gap:8px;max-width:175px;padding:4px 8px 4px 4px;border:1px solid var(--sgp-border);border-radius:999px; }
.sgp-user-avatar { width:29px;height:29px;display:grid;place-items:center;border-radius:50%;background:rgba(83,104,232,.2);color:#aab5ff;font-size:.78rem;font-weight:800; }
.sgp-user-nickname { overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.82rem;font-weight:700; }
.sgp-login-button { min-height:39px;display:flex;align-items:center;justify-content:center;padding:0 17px;border-radius:10px;background:var(--sgp-accent);color:#fff!important;font-size:.84rem;font-weight:750;text-decoration:none;white-space:nowrap;box-shadow:0 5px 14px rgba(83,104,232,.22); }
.sgp-login-button:hover { background:#6578f0;color:#fff;text-decoration:none; }
.sgp-logout-button { background:rgba(255,255,255,.07);border:1px solid var(--sgp-border);box-shadow:none; }
.sgp-menu-toggle,.sgp-mobile-account { display:none; }

/* Theme state toggled by the header switch; page styles can key off data-theme. */
html[data-sgp-theme="light"] .sgp-header {
  --sgp-bg:#ffffff;--sgp-panel:#ffffff;--sgp-text:#182033;--sgp-muted:#68738a;
  --sgp-border:rgba(24,32,51,.12);box-shadow:0 7px 24px rgba(22,34,64,.07);
}
html[data-sgp-theme="light"] .sgp-theme-sun { display:none; }
html[data-sgp-theme="light"] .sgp-theme-moon { display:inline; }
html[data-sgp-theme="light"] .sgp-icon-button { background:#f6f7fb; }
html[data-sgp-theme="light"] .sgp-user-chip { background:#f8f9fc; }

@media (max-width:1050px) {
  .sgp-header__inner { width:calc(100% - 22px);gap:13px;min-height:66px; }
  .sgp-brand__word { font-size:1.05rem; }
  .sgp-navigation { gap:0; }
  .sgp-navigation a,.sgp-nav-group summary { padding:0 9px;font-size:.8rem; }
  .sgp-user-nickname { max-width:90px; }
}
@media (max-width:780px) {
  .sgp-header__inner { min-height:62px;gap:11px; }
  .sgp-menu-toggle { width:39px;height:39px;display:flex;flex-direction:column;justify-content:center;gap:5px;padding:9px;border:1px solid var(--sgp-border);border-radius:10px;background:transparent;cursor:pointer;order:3; }
  .sgp-menu-toggle span { height:2px;width:100%;border-radius:2px;background:var(--sgp-text);transition:transform .2s,opacity .2s; }
  .sgp-menu-toggle[aria-expanded="true"] span:first-child { transform:translateY(7px) rotate(45deg); }
  .sgp-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity:0; }
  .sgp-menu-toggle[aria-expanded="true"] span:last-child { transform:translateY(-7px) rotate(-45deg); }
  .sgp-navigation { display:none;position:absolute;top:100%;left:0;right:0;z-index:30;max-height:calc(100vh - 62px);overflow:auto;padding:10px 14px 16px;background:var(--sgp-bg);border-bottom:1px solid var(--sgp-border);box-shadow:0 16px 28px rgba(0,0,0,.2);align-items:stretch; }
  .sgp-navigation.is-open { display:flex;flex-direction:column; }
  .sgp-navigation > a,.sgp-nav-group summary { min-height:44px;padding:0 12px;font-size:.9rem; }
  .sgp-nav-group { width:100%; }
  .sgp-nav-group summary { justify-content:space-between; }
  .sgp-dropdown { position:static;max-height:none;min-width:0;margin:2px 0 8px;padding:5px;background:rgba(128,145,255,.055);box-shadow:none; }
  .sgp-dropdown a,.sgp-dropdown .sgp-menu-action { min-height:39px; }
  .sgp-mobile-account { display:flex;gap:8px;padding:10px 3px 0;border-top:1px solid var(--sgp-border); }
  .sgp-mobile-account a { flex:1;justify-content:center;background:rgba(83,104,232,.12);color:var(--sgp-text); }
  .sgp-header-tools { gap:6px;margin-left:auto; }
  .sgp-user-chip { max-width:130px; }
  .sgp-user-nickname { max-width:75px; }
  .sgp-login-button { min-height:37px;padding:0 12px;font-size:.8rem; }
}
@media (max-width:430px) {
  .sgp-header__inner { width:calc(100% - 16px);gap:8px; }
  .sgp-brand { gap:7px; }
  .sgp-brand__mark { width:26px;height:26px; }
  .sgp-brand__word { font-size:.95rem; }
  .sgp-icon-button { width:35px;height:35px;border-radius:9px; }
  .sgp-user-chip { border:0;padding:0; }
  .sgp-user-avatar { width:32px;height:32px; }
  .sgp-user-nickname { display:none; }
  .sgp-header-tools { gap:5px; }
}
