/* ============================================================
   NovaSounds — sidebar.css
   Shared left sidebar for ALL logged-in pages.
   Works for Readers, Writers, and Voice Artists.
   Include this on: CreatorDashboard, Wallet, Profile,
   Notifications, Contests, and any future dashboard page.
   ============================================================ */

/* ── Sidebar width token ── */
:root {
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 68px;
  --topbar-h: 56px;
}

/* ============================================================
   TOP BAR (replaces the old .navbar on logged-in pages)
   ============================================================ */
.app-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 0;
  z-index: 800;
  transition: background 0.4s ease;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0;
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding-left: 20px;
  transition: width 0.3s ease;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.topbar-logo img {
  height: 36px;
  width: auto;
  filter: drop-shadow(0 0 6px rgba(42,157,120,0.5)) brightness(1.2);
}

.topbar-logo-text {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.topbar-logo-nova {
  font-style: italic;
  background: linear-gradient(135deg, #2fc99a, #1e9e70);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-logo-sounds {
  background: linear-gradient(135deg, #d4a030, #b8892a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Hamburger toggle */
.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--ink2);
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-left: auto;
  transition: color var(--transition);
}

.sidebar-toggle:hover { color: var(--gold); }

.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* Notification bell */
.topbar-notif {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--ink2);
  font-size: 1.1rem;
  transition: color var(--transition), background var(--transition);
}

.topbar-notif:hover {
  color: var(--gold);
  background: var(--gold-subtle);
}

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--crimson);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
}

/* Theme toggle (compact for topbar) */
.topbar-theme {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink2);
  cursor: pointer;
  transition: all var(--transition);
}

.topbar-theme:hover {
  border-color: var(--gold);
  color: var(--ink);
}

/* User avatar + name */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.topbar-user:hover {
  background: var(--card);
  border-color: var(--border);
}

.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #080810;
  flex-shrink: 0;
  font-family: var(--mono);
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.topbar-user-role {
  font-size: 10px;
  color: var(--gold);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================================
   SIDEBAR SHELL
   ============================================================ */
.app-sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 700;
  transition: width 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* Collapsed state */
.app-sidebar.collapsed { width: var(--sidebar-collapsed-w); }
.app-sidebar.collapsed .sidebar-label,
.app-sidebar.collapsed .sidebar-item-text,
.app-sidebar.collapsed .sidebar-section-title,
.app-sidebar.collapsed .sidebar-user-detail,
.app-sidebar.collapsed .sidebar-plan-badge { opacity: 0; width: 0; overflow: hidden; white-space: nowrap; }

/* ============================================================
   SIDEBAR — USER CARD (top of sidebar)
   ============================================================ */
.sidebar-user-card {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #080810;
  flex-shrink: 0;
  font-family: var(--mono);
  border: 2px solid var(--border2);
}

.sidebar-user-detail { min-width: 0; transition: opacity 0.2s ease, width 0.3s ease; }

.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  transition: opacity 0.2s ease;
}

.plan-free    { background: rgba(90,88,112,0.2);  color: var(--ink3);    border: 1px solid var(--border2); }
.plan-creator { background: rgba(212,168,67,0.12); color: var(--gold);   border: 1px solid rgba(212,168,67,0.3); }
.plan-pro     { background: rgba(123,104,200,0.12);color: var(--lavender);border: 1px solid rgba(123,104,200,0.3); }
.plan-reader  { background: rgba(46,184,164,0.1);  color: var(--teal);   border: 1px solid rgba(46,184,164,0.25); }

/* ============================================================
   SIDEBAR — NAV SECTIONS
   ============================================================ */
.sidebar-nav {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink3);
  padding: 8px 10px 4px;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink2);
  font-size: 13px;
  font-weight: 400;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  border: 1px solid transparent;
}

.sidebar-item:hover {
  background: var(--card);
  color: var(--ink);
  border-color: var(--border);
}

.sidebar-item.active {
  background: var(--gold-subtle);
  color: var(--gold);
  border-color: rgba(212,168,67,0.2);
  font-weight: 500;
}

.sidebar-item.active .sidebar-item-icon { color: var(--gold); }

.sidebar-item-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--transition);
}

.sidebar-item-text {
  flex: 1;
  transition: opacity 0.2s ease, width 0.3s ease;
}

/* Pill badge on sidebar items (e.g. unread count) */
.sidebar-pill {
  background: var(--crimson);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  font-family: var(--mono);
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.sidebar-item.active .sidebar-pill {
  background: var(--gold);
  color: #080810;
}

/* Tooltip when collapsed */
.app-sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 10px;
}

.app-sidebar.collapsed .sidebar-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   SIDEBAR — BOTTOM UPGRADE PROMPT
   ============================================================ */
.sidebar-upgrade {
  margin: 12px 8px;
  padding: 14px;
  background: var(--gold-subtle);
  border: 1px solid rgba(212,168,67,0.2);
  border-radius: var(--radius-md);
  transition: opacity 0.2s ease;
}

.app-sidebar.collapsed .sidebar-upgrade { display: none; }

.sidebar-upgrade-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 4px;
}

.sidebar-upgrade-sub {
  font-size: 11px;
  color: var(--ink3);
  margin-bottom: 10px;
  line-height: 1.5;
}

.sidebar-upgrade-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: var(--gold);
  color: #080810;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition);
}

.sidebar-upgrade-btn:hover { background: var(--gold-hover); }

/* ============================================================
   MAIN CONTENT AREA — offset for sidebar + topbar
   ============================================================ */
.app-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left 0.3s ease;
  padding: 40px 48px;
}

.app-sidebar.collapsed ~ .app-main,
body.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed-w);
}

/* ============================================================
   MOBILE SIDEBAR OVERLAY
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,8,16,0.7);
  z-index: 690;
  backdrop-filter: blur(2px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .app-main { padding: 32px 28px; }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.mobile-open ~ .sidebar-overlay,
  .sidebar-overlay.active { display: block; }
  .app-main { margin-left: 0; padding: 24px 16px; }
  .topbar-left { width: auto; }
  .topbar-user-info { display: none; }
}

/* ============================================================
   LIGHT THEME OVERRIDES
   ============================================================ */
html.light-theme .app-sidebar {
  background: #faf8f5;
  border-right-color: var(--border);
}

html.light-theme .sidebar-item:hover {
  background: #f0ece6;
}

html.light-theme .sidebar-item.active {
  background: rgba(184,134,28,0.08);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sidebar-item { animation: fadeIn 0.3s ease both; }
.sidebar-item:nth-child(1) { animation-delay: 0.02s; }
.sidebar-item:nth-child(2) { animation-delay: 0.04s; }
.sidebar-item:nth-child(3) { animation-delay: 0.06s; }
.sidebar-item:nth-child(4) { animation-delay: 0.08s; }
.sidebar-item:nth-child(5) { animation-delay: 0.10s; }
.sidebar-item:nth-child(6) { animation-delay: 0.12s; }
.sidebar-item:nth-child(7) { animation-delay: 0.14s; }
.sidebar-item:nth-child(8) { animation-delay: 0.16s; }
/* ============================================================
   CONTRACTS SECTION + COMMAND CENTRE ENTRY
   New collapsible sidebar blocks added in sidebar.js
   ============================================================ */

/* ── Collapsible section block wrapper ── */
.sidebar-section-block {
  margin: 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  overflow: hidden;
}

.app-sidebar.collapsed .sidebar-section-block { display: none; }

/* ── Toggle header row ── */
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.sidebar-section-toggle:hover { background: var(--gold-subtle); }

.sidebar-section-toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.sidebar-section-toggle-icon { font-size: 14px; flex-shrink: 0; }

.sidebar-section-toggle-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink3);
  flex: 1;
}

.sidebar-section-toggle-arrow {
  font-size: 16px;
  color: var(--ink3);
  transition: color var(--transition);
  flex-shrink: 0;
}

.sidebar-section-toggle:hover .sidebar-section-toggle-arrow { color: var(--gold); }

/* ── Collapsible body ── */
.sidebar-section-body {
  border-top: 1px solid var(--border);
  padding: 12px;
}

/* ============================================================
   CONTRACTS — Summary strip
   ============================================================ */
.ctr-summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}

.ctr-sum-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.ctr-sum-num {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  font-family: var(--mono);
  line-height: 1;
}

.ctr-sum-lbl {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink3);
  font-family: var(--mono);
}

.cs-pending-card { border-color: rgba(212,168,67,0.3); background: rgba(212,168,67,0.06); }
.cs-pending-card .ctr-sum-num { color: var(--gold); }

.cs-active-card  { border-color: rgba(46,184,164,0.25); background: rgba(46,184,164,0.05); }
.cs-active-card .ctr-sum-num  { color: var(--teal); }

.cs-expired-card .ctr-sum-num { color: var(--ink3); }

/* ============================================================
   CONTRACTS — Group labels
   ============================================================ */
.ctr-group-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink3);
  margin: 8px 0 5px;
  padding-left: 2px;
}

.cs-pending-label { color: var(--gold); }
.cs-active-label  { color: var(--teal); }

/* ============================================================
   CONTRACTS — Cards
   ============================================================ */
.ctr-card {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 0.15s ease;
}

.ctr-card:hover {
  background: var(--card);
  border-color: var(--border2);
  transform: translateX(2px);
}

.ctr-card.cs-pending {
  border-color: rgba(212,168,67,0.35);
  background: rgba(212,168,67,0.04);
}

.ctr-card.cs-active,
.ctr-card.cs-signed  { border-color: rgba(46,184,164,0.25); }
.ctr-card.cs-expired { opacity: 0.6; }
.ctr-card.cs-rejected{ opacity: 0.55; }

.ctr-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.ctr-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
  line-height: 1.3;
}

/* Status badge chip */
.ctr-status-badge {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.ctr-status-badge.cs-pending  { background: rgba(212,168,67,0.15);  color: var(--gold); }
.ctr-status-badge.cs-signed   { background: rgba(46,184,164,0.15);  color: var(--teal); }
.ctr-status-badge.cs-active   { background: rgba(46,184,164,0.15);  color: var(--teal); }
.ctr-status-badge.cs-expired  { background: rgba(100,100,120,0.15); color: var(--ink3); }
.ctr-status-badge.cs-rejected { background: rgba(224,92,92,0.12);   color: var(--crimson); }

.ctr-card-meta {
  font-size: 10px;
  color: var(--ink3);
  display: flex;
  gap: 4px;
  margin-bottom: 2px;
}

.ctr-card-party {
  font-size: 10px;
  color: var(--ink3);
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctr-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.ctr-id   { font-size: 9px; color: var(--ink3); font-family: var(--mono); }
.ctr-date { font-size: 9px; color: var(--ink3); }
.ctr-expiry-warn { font-size: 9px; color: #e09040; }

/* Sign Now button on card */
.ctr-sign-btn {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: #080810;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

.ctr-sign-btn:hover { opacity: 0.85; }

/* Pending badge pill in toggle header */
.cs-pill-urgent {
  background: var(--gold);
  color: #080810;
  font-size: 8px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  font-family: var(--mono);
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

/* View all link */
.ctr-view-all {
  display: block;
  text-align: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--gold);
  text-decoration: none;
  padding: 7px;
  border-radius: 8px;
  border: 1px dashed rgba(212,168,67,0.3);
  transition: background var(--transition);
}

.ctr-view-all:hover { background: var(--gold-subtle); }

/* ============================================================
   COMMAND CENTRE ENTRY (Nova Leads + Admin)
   ============================================================ */

/* Gold-tinted toggle for Command Centre */
.sidebar-section-toggle-admin .sidebar-section-toggle-label { color: var(--gold); }

.sidebar-adminpanel-block {
  border-color: rgba(212,168,67,0.25);
  background: rgba(212,168,67,0.04);
}

.sidebar-adminpanel-block .sidebar-section-toggle:hover {
  background: rgba(212,168,67,0.08);
}

/* Identity card */
.ap-identity-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gold-subtle);
  border: 1px solid rgba(212,168,67,0.25);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.ap-identity-icon { font-size: 22px; flex-shrink: 0; }

.ap-identity-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.ap-identity-role {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 3px;
}

/* Description text */
.ap-description {
  font-size: 11px;
  color: var(--ink3);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* Launch button */
.ap-launch-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--gold) 0%, #a07830 100%);
  color: #080810;
  font-size: 12px;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  transition: opacity var(--transition), transform 0.15s ease;
  margin-bottom: 8px;
}

.ap-launch-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.ap-launch-arrow { font-size: 14px; }

.ap-note {
  font-size: 10px;
  color: var(--ink3);
  line-height: 1.55;
}

/* ============================================================
   CONTRACT DETAIL + SIGN MODALS  (rendered into <body>)
   ============================================================ */
.ns-contract-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,16,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: nsModalFadeIn 0.2s ease;
}

@keyframes nsModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ns-contract-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  /* Constrain height and allow body to scroll */
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg, 0 24px 60px rgba(0,0,0,0.45));
  animation: nsModalSlideUp 0.22s cubic-bezier(0.32,0.72,0,1);
  /* overflow:hidden keeps border-radius; body scrolls independently */
  overflow: hidden;
}

@keyframes nsModalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.ns-contract-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  /* Stick header at top so close button is always reachable */
  flex-shrink: 0;
}

.ns-contract-modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.ns-contract-modal-sub {
  font-size: 11px;
  color: var(--ink3);
  margin-top: 3px;
  font-family: var(--mono);
}

.ns-contract-modal-close {
  background: none;
  border: none;
  color: var(--ink3);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.ns-contract-modal-close:hover {
  background: var(--card);
  color: var(--ink);
}

.ns-contract-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.ns-contract-modal-body::-webkit-scrollbar { width: 4px; }
.ns-contract-modal-body::-webkit-scrollbar-track { background: transparent; }
.ns-contract-modal-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* Status strip inside modal */
.ns-contract-status-strip {
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.ns-contract-status-strip.cs-pending  { background: rgba(212,168,67,0.12);  color: var(--gold); }
.ns-contract-status-strip.cs-active   { background: rgba(46,184,164,0.12);  color: var(--teal); }
.ns-contract-status-strip.cs-signed   { background: rgba(46,184,164,0.12);  color: var(--teal); }
.ns-contract-status-strip.cs-expired  { background: rgba(100,100,120,0.1);  color: var(--ink3); }
.ns-contract-status-strip.cs-rejected { background: rgba(224,92,92,0.1);    color: var(--crimson); }

/* Detail key/value grid */
.ns-contract-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.ns-cd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  gap: 12px;
}

.ns-cd-label { color: var(--ink3); flex-shrink: 0; }
.ns-cd-val   { color: var(--ink);  font-weight: 600; text-align: right; }
.ns-cd-warn  { color: #e09040; }

/* Sign zone inside detail modal - stays in scroll body */
.ns-contract-sign-zone,
.ns-contract-download-zone {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}

.ns-contract-sign-notice {
  font-size: 11px;
  color: var(--ink3);
  line-height: 1.6;
  margin-bottom: 12px;
}

.ns-contract-sign-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Shared button styles */
.ns-btn-outline {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: none;
  border: 1px solid var(--border2);
  color: var(--ink2);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.ns-btn-outline:hover {
  border-color: var(--ink2);
  color: var(--ink);
}

.ns-btn-sign {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: #080810;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition);
}

.ns-btn-sign:hover:not(:disabled) { opacity: 0.85; }
.ns-btn-sign:disabled { cursor: not-allowed; }

/* Sign confirmation modal specifics */
/* Body scrolls; header + footer are flex-shrink:0 and never move */
.ns-sign-modal .ns-contract-modal-body { padding-top: 16px; }

.ns-sign-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ns-sign-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  gap: 12px;
}

.ns-sign-row span  { color: var(--ink3); }
.ns-sign-row strong{ color: var(--ink); font-weight: 600; text-align: right; }

/* True footer — flex-shrink:0 so it never gets pushed off screen */
.ns-sign-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ns-sign-agree-box {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 11px 13px;
}

.ns-sign-agree-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink2);
  line-height: 1.6;
}

.ns-sign-agree-label input {
  margin-top: 2px;
  accent-color: var(--gold);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.ns-sign-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.ns-sign-legal {
  font-size: 10px;
  color: var(--ink3);
  text-align: center;
  line-height: 1.55;
}

/* ============================================================
   TOAST NOTIFICATION  (rendered into <body>)
   ============================================================ */
.ns-sidebar-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface);
  border: 1px solid rgba(212,168,67,0.4);
  color: var(--ink);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.3));
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  font-family: var(--sans, sans-serif);
}

.ns-sidebar-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   LIGHT THEME OVERRIDES — new sections
   ============================================================ */
html.light-theme .sidebar-section-block {
  background: #f5f2ee;
  border-color: var(--border);
}

html.light-theme .ctr-sum-card   { background: #fff; }
html.light-theme .ctr-card       { background: #fff; }
html.light-theme .ctr-card:hover { background: #f5f2ee; }

html.light-theme .ap-identity-card { background: rgba(212,168,67,0.08); }

html.light-theme .ns-contract-modal { background: #faf8f5; }
html.light-theme .ns-sign-summary   { background: #f0ece6; }
html.light-theme .ns-sign-agree-box { background: #fff; }
/* ============================================================
   ADMIN SWITCHER — direct link button at bottom of sidebar
   ============================================================ */
.sidebar-admin-switcher {
  margin: 8px 8px 4px;
}

.ap-switcher-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(212,168,67,0.12) 0%, rgba(42,157,120,0.08) 100%);
  border: 1px solid rgba(212,168,67,0.3);
  border-radius: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  gap: 12px;
}

.ap-switcher-btn:hover {
  background: linear-gradient(135deg, rgba(212,168,67,0.2) 0%, rgba(42,157,120,0.12) 100%);
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(212,168,67,0.15);
}

.ap-switcher-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ap-switcher-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.ap-switcher-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

.ap-switcher-role {
  font-size: 10px;
  color: var(--ink3);
  font-family: var(--mono);
  margin-top: 2px;
  white-space: nowrap;
}

.ap-switcher-arrow {
  font-size: 14px;
  color: var(--gold);
  flex-shrink: 0;
  opacity: 0.7;
}

.app-sidebar.collapsed .sidebar-admin-switcher { display: none; }

/* ============================================================
   FULL CONTRACT DETAIL MODAL — wider, scrollable
   ============================================================ */
.ns-contract-modal-full {
  max-width: 580px !important;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.ns-contract-modal-full .ns-contract-modal-body {
  overflow-y: auto;
  flex: 1;
}

/* Quick facts grid */
.ns-contract-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.ns-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.ns-fact-lbl {
  font-size: 9px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink3);
}

.ns-fact-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

/* Section heading inside modal */
.ns-section-hd {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  letter-spacing: 0.03em;
}

/* Parties list */
.ns-parties-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.ns-party-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}

.ns-party-row.ns-party-you {
  border-color: rgba(212,168,67,0.35);
  background: rgba(212,168,67,0.06);
}

.ns-party-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ns-party-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.ns-you-tag {
  display: inline-block;
  font-size: 9px;
  background: var(--gold);
  color: #080810;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 800;
  font-family: var(--mono);
  vertical-align: middle;
  margin-left: 4px;
}

.ns-party-username {
  font-size: 10px;
  color: var(--ink3);
  font-family: var(--mono);
}

.ns-party-role-tag {
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink2);
  padding: 1px 7px;
  border-radius: 6px;
  width: fit-content;
}

.ns-party-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.ns-party-pay {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  white-space: nowrap;
}

.ns-pay-rev  { background: rgba(46,184,164,0.12); color: var(--teal); }
.ns-pay-lump { background: rgba(123,104,200,0.12); color: var(--lavender, #9b88d8); }

.ns-party-sig {
  font-size: 10px;
  font-family: var(--mono);
  white-space: nowrap;
}

.ns-sig-done { color: var(--teal); }
.ns-sig-pend { color: var(--gold); }

.ns-rev-note {
  font-size: 10px;
  color: var(--ink3);
  line-height: 1.5;
  margin-bottom: 4px;
  font-style: italic;
}

/* Content Lead row */
.ns-cl-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
}

.ns-cl-icon { font-size: 1.1rem; flex-shrink: 0; }
.ns-cl-name { font-size: 13px; font-weight: 700; color: var(--ink); margin-right: 6px; }
.ns-cl-username { font-size: 10px; color: var(--ink3); font-family: var(--mono); margin-right: 6px; }
.ns-cl-tag  { font-size: 10px; color: var(--ink3); font-style: italic; display: block; margin-top: 2px; }

/* Special terms box */
.ns-special-terms {
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.65;
  background: rgba(212,168,67,0.05);
  border: 1px solid rgba(212,168,67,0.2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
}

/* PDF download button variant */
.ns-btn-pdf {
  width: 100%;
  justify-content: center;
  padding: 10px 16px;
  font-size: 13px;
}

/* ── Sign modal — your deal highlight ── */
.ns-sign-your-deal {
  background: rgba(46,184,164,0.08);
  border: 1px solid rgba(46,184,164,0.25);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  text-align: center;
}

.ns-sign-deal-label {
  font-size: 9px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink3);
  margin-bottom: 4px;
}

.ns-sign-deal-val {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}

.ns-sign-summary-hd {
  font-size: 9px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink3);
  margin-bottom: 8px;
}

.ns-sign-terms-box {
  background: rgba(212,168,67,0.05);
  border: 1px solid rgba(212,168,67,0.2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

/* ── Light theme ── */
html.light-theme .ns-fact           { background: #fff; }
html.light-theme .ns-party-row      { background: #fff; }
html.light-theme .ns-party-row.ns-party-you { background: rgba(212,168,67,0.06); }
html.light-theme .ns-cl-row         { background: #fff; }
html.light-theme .ap-switcher-btn   { background: rgba(212,168,67,0.06); }
/* ============================================================
   SKELETON LOADER — shown while Firebase resolves user data
   Used by both the sidebar user card and the topbar avatar.
   ============================================================ */
@keyframes ns-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.ns-skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    color-mix(in srgb, var(--border) 60%, var(--surface)) 50%,
    var(--border) 75%
  );
  background-size: 800px 100%;
  animation: ns-shimmer 1.4s infinite linear;
  display: block;
}

.ns-skeleton-circle {
  border-radius: 50% !important;
  /* Override any text content that might show through */
  color: transparent !important;
  font-size: 0 !important;
}

.ns-skeleton-text {
  border-radius: 6px;
}

/* Make the topbar avatar shimmer correctly */
.topbar-avatar.ns-skeleton {
  width: 34px;
  height: 34px;
}

/* Make the sidebar avatar shimmer correctly */
.sidebar-avatar.ns-skeleton {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}