/* =============================================================================
   Linkorae — Customer Shell (left sidebar + main content area)
   -----------------------------------------------------------------------------
   Used on pages where the customer is "logged in": my-orders, quote (logged),
   checkout, order-detail. Provides a fixed left sidebar on desktop and a
   hamburger-driven drawer on mobile.
   ============================================================================= */

:root {
  --cs-sidebar-w: 280px;
  --cs-brand-dark: #0A1628;
  --cs-brand-orange: #FF6B00;
  --cs-brand-orange-hover: #E8941B;
  --cs-border: #E5E7EB;
  --cs-bg-soft: #F8FAFC;
  --cs-text: #1E293B;
  --cs-muted: #64748B;
}

.cs-shell {
  display: block;
  min-height: 100vh;
  background: var(--cs-bg-soft);
}

/* Topbar (mobile only by default) */
.cs-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--cs-brand-dark);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  min-height: 56px;
}
.cs-topbar__toggle {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: #fff;
  border-radius: 8px; cursor: pointer;
}
.cs-topbar__toggle:hover { background: rgba(255,255,255,0.08); }
.cs-topbar__toggle svg { width: 24px; height: 24px; }
.cs-topbar__brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none; flex: 1; min-width: 0;
}
.cs-topbar__brand b { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-topbar__brand span { display: block; font-size: 10px; color: var(--cs-brand-orange); letter-spacing: 1px; }
.cs-topbar__right a {
  color: #fff; text-decoration: none; font-size: 13px;
  padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.22);
  white-space: nowrap;
}
.cs-topbar__right a:hover { background: rgba(255,255,255,0.1); }

/* Sidebar */
.cs-sidebar {
  position: fixed;
  top: 0; bottom: 0; left: calc(-1 * var(--cs-sidebar-w));
  width: var(--cs-sidebar-w);
  background: var(--cs-brand-dark);
  color: #fff;
  z-index: 200;
  transition: left .25s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.cs-sidebar.cs-open { left: 0; box-shadow: 2px 0 20px rgba(0,0,0,0.3); }

.cs-sidebar__brand {
  padding: 20px 22px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.cs-sidebar__brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--cs-brand-orange);
  display: flex; align-items: center; justify-content: center;
  color: var(--cs-brand-dark); font-weight: 800; font-size: 20px;
  flex-shrink: 0;
}
.cs-sidebar__brand-text { line-height: 1.15; min-width: 0; }
.cs-sidebar__brand-text b { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-sidebar__brand-text span { display: block; font-size: 10px; color: var(--cs-brand-orange); letter-spacing: 1.2px; font-weight: 600; margin-top: 2px; }

.cs-sidebar__close {
  margin-left: auto;
  width: 44px; height: 44px;
  background: transparent; border: 0; color: #fff; cursor: pointer;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.cs-sidebar__close:hover { background: rgba(255,255,255,0.1); }

.cs-sidebar__user {
  padding: 14px 22px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.cs-sidebar__user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #334155; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.cs-sidebar__user-info { min-width: 0; line-height: 1.3; flex: 1; }
.cs-sidebar__user-info b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-sidebar__user-info span { display: block; font-size: 11px; color: rgba(255,255,255,0.55); }

/* Tier chip row inside the user block */
.cs-sidebar__user-info .cs-tier-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px;
  font-size: 11px;
}
.cs-sidebar__user-info .cs-tier-kg {
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── User display-name edit button ─────────────────────────────────────── */
.cs-name-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; padding: 0; margin: 0;
  color: inherit; cursor: pointer; max-width: 100%;
  font: inherit;
}
.cs-name-btn b {
  display: inline-block; max-width: 125px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 14px; font-weight: 700;
}
.cs-name-btn .cs-name-pencil {
  flex-shrink: 0; opacity: 0; transition: opacity 160ms ease;
  color: rgba(255,255,255,0.55);
}
.cs-sidebar__user:hover .cs-name-pencil,
.cs-name-btn:hover .cs-name-pencil,
.cs-name-btn:focus-visible .cs-name-pencil { opacity: 1; }
.cs-name-btn:hover b { color: #F5B544; }

.cs-name-input {
  display: block; width: 100%;
  background: rgba(245,181,68,0.08);
  border: 1px solid rgba(245,181,68,0.55);
  color: #fff;
  font: 600 14px/1.3 inherit;
  padding: 4px 8px; border-radius: 6px;
  outline: none;
}
.cs-name-input:focus { border-color: #F5B544; box-shadow: 0 0 0 3px rgba(245,181,68,0.18); }

.cs-user-email {
  display: block; font-size: 11px;
  color: rgba(255,255,255,0.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}

/* ── Sign-out button (icon-only, far right) ────────────────────────────── */
.cs-signout-btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: all 160ms ease;
  margin-left: auto;
}
.cs-signout-btn:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.45);
  color: #FCA5A5;
  transform: translateX(-1px);
}
.cs-signout-btn:active { transform: translateX(-1px) scale(0.96); }

/* Partnerships menu accent — subtle purple glow to signal "premium channel" */
.cs-sidebar__nav a.cta-partners {
  position: relative;
}
.cs-sidebar__nav a.cta-partners .ico {
  color: #C084FC;
}
.cs-sidebar__nav a.cta-partners:hover {
  background: rgba(168, 85, 247, 0.08);
  color: #F8FAFC;
}
.cs-sidebar__nav a.cta-partners.active {
  background: rgba(168, 85, 247, 0.16);
  color: #F8FAFC;
  box-shadow: inset 3px 0 0 #A855F7;
}
.cs-sidebar__nav a.cta-partners .cs-pill {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 100px;
  background: linear-gradient(135deg, #C084FC 0%, #A855F7 100%);
  color: #0A0E1A;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.cs-sidebar__nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cs-sidebar__nav a {
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  min-height: 46px;
  transition: background .15s, color .15s;
}
.cs-sidebar__nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.cs-sidebar__nav a.active {
  background: var(--cs-brand-orange);
  color: var(--cs-brand-dark);
  font-weight: 700;
}
.cs-sidebar__nav a .ico {
  width: 20px; height: 20px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.cs-sidebar__nav a .ico svg { width: 100%; height: 100%; }
.cs-sidebar__nav a.cta-primary {
  background: var(--cs-brand-orange);
  color: var(--cs-brand-dark);
  font-weight: 700;
}
.cs-sidebar__nav a.cta-primary:hover {
  background: var(--cs-brand-orange-hover);
  color: var(--cs-brand-dark);
}

/* Divider */
.cs-sidebar__divider {
  margin: 14px 18px 8px;
  font-size: 10px;
  color: rgba(255,255,255,0.38);
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

/* Surcharge reference card */
.cs-surcharge-card {
  margin: 8px 14px 16px;
  padding: 14px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(255,255,255,0.9);
}
.cs-surcharge-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--cs-brand-orange);
  font-weight: 700;
  letter-spacing: .3px;
  display: flex; align-items: center; gap: 6px;
}
.cs-surcharge-card .tier {
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}
.cs-surcharge-card .tier:last-child { border-bottom: 0; }
.cs-surcharge-card .tier-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-weight: 700; color: #fff; margin-bottom: 3px;
}
.cs-surcharge-card .tier-head .amt { color: var(--cs-brand-orange); font-size: 13px; }
.cs-surcharge-card .tier-detail {
  color: rgba(255,255,255,0.7);
  font-size: 11.5px;
  line-height: 1.5;
}

.cs-sidebar__foot {
  margin-top: auto;
  padding: 14px 22px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  line-height: 1.5;
}

/* Backdrop */
.cs-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,0.55);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.cs-backdrop.cs-open {
  opacity: 1;
  pointer-events: auto;
}

/* Main content area */
.cs-main {
  padding: 16px;
}

/* Desktop: sidebar always visible & fixed, main content gets offset */
@media (min-width: 1024px) {
  .cs-topbar { display: none; }
  .cs-sidebar {
    left: 0;
    box-shadow: none;
  }
  .cs-sidebar__close { display: none; }
  .cs-main {
    margin-left: var(--cs-sidebar-w);
    padding: 32px 40px;
    min-height: 100vh;
  }
  .cs-backdrop { display: none !important; }
}

/* Small helper: bring-your-own page wrap */
.cs-page-header {
  margin: 0 0 24px;
}
.cs-page-header h1 {
  margin: 0 0 4px;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
  color: var(--cs-brand-dark);
}
.cs-page-header p {
  margin: 0;
  color: var(--cs-muted);
  font-size: 14px;
}