/* Clinical records (admin_charts.html) — Command Center visual parity */

:root {
  --bg: #090d18;
  --bg2: rgba(12, 16, 28, 0.94);
  --amber: #c4a24e;
  --amber-lt: #e8c97a;
  --teal: #0fb5a0;
  --emerald: #2dd4a0;
  --coral: #c75c6e;
  --text: #e8f0ef;
  --text-dim: #a89880;
  --text-muted: #5c7572;
  --gold-border: rgba(184, 152, 63, 0.28);
  --divider: rgba(80, 160, 145, 0.14);
  --hud-line: rgba(0, 245, 255, 0.12);
  --neon-cyan: rgba(0, 234, 255, 0.45);
  --font-display: 'Marcellus', Georgia, serif;
  --font-ui: 'DM Sans', system-ui, sans-serif;
  --cc-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --panel: linear-gradient(165deg, rgba(16, 22, 40, 0.88), rgba(8, 12, 22, 0.94));
  --panel-border: rgba(80, 160, 145, 0.2);
  --atmosphere-bg-blur: 18px;
  --atmosphere-bg-scale: 1.08;
  --atmosphere-bg-overscan: -8%;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  transition: opacity 0.45s var(--cc-ease);
  overflow-x: hidden;
  position: relative;
}
body.ready { opacity: 1; }
a { color: inherit; text-decoration: none; }

/* Atmosphere — matches admin-dashboard (photo blurred in ::before) */
.cc-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(9, 13, 24, 0.52) 0%, rgba(9, 13, 24, 0.76) 48%, rgba(9, 13, 24, 0.92) 100%),
    radial-gradient(ellipse 85% 55% at 50% 100%, rgba(0, 0, 0, 0.42) 0%, transparent 72%),
    repeating-linear-gradient(0deg, rgba(139, 119, 86, 0.045) 0px, transparent 1px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(139, 119, 86, 0.045) 0px, transparent 1px, transparent 4px),
    radial-gradient(ellipse 100% 70% at 50% -14%, rgba(90, 158, 144, 0.12) 0%, transparent 52%),
    radial-gradient(ellipse 55% 45% at 100% 100%, rgba(184, 152, 63, 0.11) 0%, transparent 52%),
    radial-gradient(ellipse 50% 42% at 0% 85%, rgba(15, 90, 80, 0.11) 0%, transparent 48%);
  background-color: var(--bg);
}
.cc-atmosphere::before {
  content: '';
  position: absolute;
  inset: var(--atmosphere-bg-overscan, -8%);
  background: url('../images/atmosphere-bg.png') center / cover no-repeat;
  filter: blur(var(--atmosphere-bg-blur, 18px));
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: scale(var(--atmosphere-bg-scale, 1.08));
  transform-origin: center center;
  z-index: -1;
  pointer-events: none;
}
.cc-atmosphere::after {
  content: '';
  position: absolute;
  inset: -8%;
  opacity: 0.5;
  background:
    radial-gradient(circle at 22% 28%, rgba(15, 181, 160, 0.16) 0%, transparent 42%),
    radial-gradient(circle at 88% 62%, rgba(196, 162, 78, 0.12) 0%, transparent 38%);
  animation: ccAmbientDrift 22s ease-in-out infinite alternate;
}
@keyframes ccAmbientDrift {
  from { transform: scale(1) translate(0, 0) rotate(0deg); }
  to { transform: scale(1.05) translate(1.2%, -1%) rotate(0.4deg); }
}

.records-app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
}
.records-app-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, var(--hud-line) 1px, transparent 1px),
    linear-gradient(180deg, var(--hud-line) 1px, transparent 1px),
    radial-gradient(circle at 1px 1px, rgba(15, 181, 160, 0.11) 1px, transparent 0);
  background-size: 48px 48px, 48px 48px, 20px 20px;
  opacity: 0.28;
  mask-image: radial-gradient(ellipse 75% 70% at 50% 42%, #000 18%, transparent 72%);
}

/* Auth gate */
#loginGate {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  gap: 16px;
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(180deg, rgba(9, 13, 24, 0.97) 0%, rgba(7, 10, 18, 0.99) 100%);
}
.gate-emblem {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(15, 181, 160, 0.75);
  margin-bottom: 4px;
}
.gate-mono {
  width: 52px;
  height: 52px;
  opacity: 0.85;
  margin-bottom: 4px;
}
.gate-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.06em;
}
.gate-sub {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.5;
}
.btn-gold {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 12px 28px;
  border-radius: 100px;
  cursor: pointer;
  border: 1px solid rgba(15, 181, 160, 0.45);
  color: var(--emerald);
  background: linear-gradient(165deg, rgba(15, 181, 160, 0.22), rgba(15, 181, 160, 0.08));
  box-shadow: 0 4px 24px rgba(15, 181, 160, 0.15);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn-gold:hover {
  border-color: rgba(0, 234, 255, 0.45);
  box-shadow: 0 6px 32px rgba(15, 181, 160, 0.22);
  background: linear-gradient(165deg, rgba(15, 181, 160, 0.32), rgba(15, 181, 160, 0.12));
}

#adminContent {
  display: none;
  flex-direction: column;
}

/* Topbar */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  min-height: 72px;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  background: rgba(9, 13, 24, 0.78);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  border-bottom: 1px solid rgba(80, 160, 145, 0.14);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}
.admin-topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(15, 181, 160, 0.35) 20%, rgba(196, 162, 78, 0.45) 50%, rgba(15, 181, 160, 0.3) 80%, transparent 100%);
  opacity: 0.85;
  pointer-events: none;
}
.topbar-gold { display: none; }
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
  min-width: 0;
}
.topbar-mono-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(80, 160, 145, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 13, 24, 0.55);
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(15, 181, 160, 0.1);
}
.topbar-mono { width: 28px; height: 28px; opacity: 0.9; }
.topbar-brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-eyebrow {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(15, 181, 160, 0.72);
}
.topbar-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  color: #e8dfc8;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.topbar-sub {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.topbar-crumb {
  color: rgba(0, 234, 255, 0.55);
  transition: color 0.2s;
}
.topbar-crumb:hover { color: rgba(0, 234, 255, 0.9); }
.topbar-sep {
  margin: 0 6px;
  color: var(--text-muted);
  font-weight: 400;
}
#topbarSub { color: var(--amber-lt); }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-out,
.btn-back {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--gold-border);
  padding: 8px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-out:hover,
.btn-back:hover {
  color: var(--text);
  border-color: rgba(15, 181, 160, 0.4);
  background: rgba(15, 181, 160, 0.06);
}

/* Art banner hero — same family as Command Center (admin-dashboard) */
.records-cc-hero.cc-hero {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  min-height: clamp(160px, 18vw, 220px);
  height: clamp(160px, 18vw, 220px);
  overflow: hidden;
  border-top: 1px solid rgba(80, 160, 145, 0.28);
  border-bottom: 1px solid rgba(80, 160, 145, 0.28);
  background: #05080f;
}
.records-cc-hero.cc-hero::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 3px;
  border-radius: 2px 0 0 2px;
  background: linear-gradient(180deg, #0fb5a0, #e8c97a);
  opacity: 0.95;
  z-index: 9;
  pointer-events: none;
}
.records-cc-hero.cc-hero.mbr-banner-stage .cc-hero-img.mbr-banner-asset {
  object-position: 46% 44%;
  filter: brightness(1.02) saturate(1.15) contrast(1.05);
}
.records-cc-hero.cc-hero.mbr-banner-stage .mbr-banner-scrim {
  opacity: 1;
}
.records-cc-hero .cc-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to right, rgba(9, 13, 24, 0.38) 0%, rgba(9, 13, 24, 0.18) 32%, rgba(9, 13, 24, 0.52) 62%, rgba(9, 13, 24, 0.86) 84%, rgba(9, 13, 24, 0.94) 100%),
    linear-gradient(to bottom, rgba(9, 13, 24, 0.28) 0%, rgba(9, 13, 24, 0.06) 35%, rgba(9, 13, 24, 0) 68%, rgba(9, 13, 24, 0.32) 100%);
}
.records-cc-hero .cc-hero-tint {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse 55% 70% at 22% 42%, rgba(15, 181, 160, 0.1) 0%, transparent 55%);
}
.records-cc-hero .cc-hero-return {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 14px 9px 12px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(232, 240, 239, 0.95);
  background: rgba(7, 10, 20, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(80, 160, 145, 0.38);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.records-cc-hero .cc-hero-return:hover {
  border-color: rgba(0, 234, 255, 0.45);
  background: rgba(15, 22, 38, 0.72);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
}
.records-cc-hero .cc-hero-return svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  opacity: 0.9;
}
.records-cc-hero .cc-hero-content {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  text-align: right;
  max-width: min(480px, 54vw);
  width: min(480px, 54vw);
  padding: 12px calc(14px + 10px) 12px 16px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  box-sizing: border-box;
}
.records-cc-hero .cc-hero-eyebrow {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(15, 181, 160, 0.78);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}
.records-cc-hero .cc-hero-eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: linear-gradient(to left, rgba(15, 181, 160, 0.75), transparent);
}
.records-cc-hero .cc-hero-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 3.2vw, 30px);
  font-weight: 300;
  color: #e8dfc8;
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 100%;
}
.records-cc-hero .cc-hero-title-line {
  display: block;
  white-space: nowrap;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
}
.records-cc-hero .cc-hero-title .cc-hero-accent {
  color: var(--amber-lt);
}
.records-cc-hero .cc-hero-lead {
  font-size: clamp(12px, 1.35vw, 14px);
  line-height: 1.55;
  color: rgba(232, 240, 239, 0.88);
  margin: 0;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
  max-width: 42ch;
  min-height: calc(1.55em * 2);
  max-height: calc(1.55em * 2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-align: right;
}

/* Directory list: filter pills in banner (below instructions) */
.records-cc-hero--directory.cc-hero {
  min-height: clamp(200px, 24vw, 280px);
}
.records-cc-hero--directory .cc-hero-content {
  gap: 12px;
}
.directory-hero-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
  max-width: 100%;
}
.directory-hero-filters .filter-pill {
  background: rgba(7, 10, 20, 0.5);
  border-color: rgba(80, 160, 145, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.directory-hero-filters .filter-pill:hover,
.directory-hero-filters .filter-pill.active {
  background: rgba(196, 162, 78, 0.12);
  border-color: rgba(196, 162, 78, 0.5);
}

@media (max-width: 720px) {
  .records-cc-hero--directory .cc-hero-content {
    align-items: flex-start;
    text-align: left;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform: translateY(-50%);
  }
  .records-cc-hero--directory .cc-hero-eyebrow {
    justify-content: flex-start;
  }
  .records-cc-hero--directory .cc-hero-eyebrow::before {
    display: none;
  }
  .records-cc-hero--directory .cc-hero-title-line {
    text-align: left;
  }
  .records-cc-hero--directory .cc-hero-lead {
    text-align: left;
    max-width: none;
  }
  .records-cc-hero--directory .directory-hero-filters {
    justify-content: flex-start;
  }
}

.records-cc-hero .cc-hero-bottom-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(15, 181, 160, 0.35),
    rgba(196, 162, 78, 0.5),
    rgba(15, 181, 160, 0.3),
    transparent
  );
}

/* Client record detail — art banner (title, identity, actions) */
.client-records-banner.records-cc-hero.cc-hero {
  min-height: clamp(300px, 32vw, 460px);
  height: auto;
}
.client-records-banner .client-records-banner__content {
  position: relative;
  z-index: 8;
  margin-left: clamp(132px, 16vw, 200px);
  margin-right: clamp(16px, 3vw, 36px);
  padding: 22px 8px 26px 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  text-align: right;
  box-sizing: border-box;
  max-width: 100%;
}
.client-records-banner__identity {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: clamp(20px, 3vw, 32px);
  width: 100%;
}
.client-records-banner__text {
  flex: 1;
  min-width: 0;
  max-width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 0;
}
.client-records-banner__eyebrow {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(15, 181, 160, 0.78);
  margin: 0 0 10px 0;
  width: 100%;
}
.client-records-banner__name--hero {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 400;
  color: #e8dfc8;
  letter-spacing: 0.04em;
  margin: 0 0 18px 0;
  line-height: 1.12;
  text-shadow: 0 2px 32px rgba(0, 0, 0, 0.5);
  width: 100%;
}
.client-records-banner__demo {
  width: 100%;
  text-align: right;
}
.banner-demo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px clamp(20px, 3vw, 36px);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.45;
  width: 100%;
}
.banner-demo-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
  padding-bottom: 2px;
}
.banner-demo-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 234, 255, 0.42);
}
.banner-demo-val {
  color: rgba(232, 240, 239, 0.92);
  word-break: break-word;
}
.client-records-banner__actions.ch-actions {
  margin-top: 0;
  padding-top: 4px;
  justify-content: flex-end;
  width: 100%;
  gap: 10px 12px;
  flex-wrap: wrap;
}
.client-records-banner .ch-photo-wrap {
  flex-shrink: 0;
  align-self: flex-start;
}

@media (max-width: 900px) and (min-width: 721px) {
  .client-records-banner__identity {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

.chart-back-dir {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 0 22px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(80, 160, 145, 0.32);
  background: rgba(7, 10, 20, 0.65);
  color: rgba(0, 234, 255, 0.78);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}
.chart-back-dir:hover {
  border-color: rgba(0, 234, 255, 0.42);
  background: rgba(15, 22, 38, 0.85);
  color: var(--emerald);
}
.chart-back-dir:active {
  transform: translateY(1px);
}

@media (max-width: 720px) {
  .client-records-banner .client-records-banner__content {
    margin-left: 12px;
    margin-right: 12px;
    align-items: stretch;
    text-align: left;
    padding-top: 52px;
    gap: 20px;
  }
  .client-records-banner .cc-hero-return {
    top: 12px;
    left: 12px;
    transform: none;
  }
  .client-records-banner__identity {
    flex-direction: column-reverse;
    align-items: center;
    gap: 20px;
  }
  .client-records-banner__text {
    align-items: flex-start;
    text-align: left;
    max-width: 100%;
  }
  .client-records-banner__eyebrow {
    text-align: left;
  }
  .client-records-banner__name--hero {
    text-align: left;
  }
  .client-records-banner__demo {
    text-align: left;
  }
  .banner-demo-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .banner-demo-cell {
    align-items: flex-start;
  }
  .client-records-banner__actions.ch-actions {
    justify-content: flex-start;
  }
}

/* Main */
.admin-main {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px 72px;
}

.page-eyebrow {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(15, 181, 160, 0.78);
  margin-bottom: 10px;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 400;
  color: #e8dfc8;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  text-shadow: 0 0 40px rgba(196, 162, 78, 0.1);
}
.page-title .page-title-accent { color: var(--amber-lt); }
.page-sub {
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.65;
  color: rgba(154, 179, 176, 0.88);
  margin-bottom: 28px;
  max-width: 48rem;
}

/* Pending intakes → create chart (admin_charts) */
.pending-intakes-panel {
  margin-bottom: 28px;
  padding: 22px 24px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}
.pending-intakes-head {
  margin-bottom: 16px;
}
.pending-intakes-eyebrow {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(15, 181, 160, 0.85);
  margin-bottom: 6px;
}
.pending-intakes-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  color: #e8dfc8;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.pending-intakes-sub {
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.55;
  color: rgba(154, 179, 176, 0.82);
  max-width: 42rem;
}
.pending-intakes-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pending-intakes-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(7, 10, 20, 0.55);
  border: 1px solid rgba(80, 160, 145, 0.16);
}
.pending-intakes-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 18px;
  min-width: 0;
  flex: 1;
}
.pending-intakes-row-main strong {
  font-weight: 600;
  color: var(--text);
}
.pending-intakes-email {
  font-size: 13px;
  color: rgba(200, 220, 216, 0.88);
}
.pending-intakes-date {
  font-size: 12px;
  color: var(--text-muted);
}
.pending-intakes-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-pending-delete {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(240, 200, 208, 0.95);
  padding: 10px 16px;
  border-radius: 100px;
  border: 1px solid rgba(199, 92, 110, 0.45);
  background: rgba(40, 18, 24, 0.55);
  cursor: pointer;
  transition: transform 0.15s var(--cc-ease), border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.btn-pending-delete:hover:not(:disabled) {
  border-color: rgba(199, 92, 110, 0.75);
  background: rgba(60, 28, 36, 0.65);
}
.btn-pending-delete:disabled {
  opacity: 0.55;
  cursor: wait;
}
.btn-pending-create {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0a1218;
  padding: 10px 18px;
  border-radius: 100px;
  border: 1px solid rgba(184, 152, 63, 0.45);
  background: linear-gradient(135deg, var(--amber-lt), var(--amber));
  cursor: pointer;
  transition: transform 0.15s var(--cc-ease), box-shadow 0.2s;
  flex-shrink: 0;
}
.btn-pending-create:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.btn-pending-create:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar-directory {
  justify-content: center;
}
.toolbar-directory .search-box-directory {
  flex: 0 1 420px;
  width: 100%;
  max-width: min(420px, 100%);
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  max-width: 360px;
  min-width: 160px;
  position: relative;
  background: rgba(7, 10, 20, 0.65);
  border: 1px solid rgba(80, 160, 145, 0.22);
  border-radius: 12px;
  display: flex;
  align-items: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: rgba(15, 181, 160, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 181, 160, 0.1);
}
.search-box svg {
  margin-left: 14px;
  flex-shrink: 0;
  color: rgba(0, 234, 255, 0.35);
}
.search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
  padding: 11px 14px 11px 8px;
}
.search-input::placeholder { color: var(--text-muted); }
.filter-pill {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 14px;
  border: 1px solid var(--gold-border);
  border-radius: 100px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.filter-pill:hover,
.filter-pill.active {
  color: var(--amber-lt);
  border-color: rgba(196, 162, 78, 0.45);
  background: rgba(196, 162, 78, 0.08);
}

/* Table panel */
.table-panel {
  background: var(--panel);
  backdrop-filter: blur(12px) saturate(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.table-panel-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.cl-table { width: 100%; border-collapse: collapse; }
.cl-table th {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--divider);
  background: linear-gradient(90deg, rgba(196, 162, 78, 0.06), rgba(15, 181, 160, 0.04));
}
.cl-table td {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-dim);
  padding: 14px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
  cursor: pointer;
}
.cl-table td strong { color: var(--text); font-weight: 600; }
.cl-table tr:hover td { background: rgba(196, 162, 78, 0.04); }
.cl-table .mono {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.cl-av-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(80, 160, 145, 0.35);
}
.cl-av-ph {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(80, 160, 145, 0.2);
  background: rgba(15, 181, 160, 0.06);
}

.badge {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
}
.badge-active {
  background: rgba(45, 212, 160, 0.12);
  color: var(--emerald);
  border: 1px solid rgba(45, 212, 160, 0.25);
}
.badge-inactive {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.badge-flagged {
  background: rgba(199, 92, 110, 0.12);
  color: #e8919e;
  border: 1px solid rgba(199, 92, 110, 0.25);
}
.flag-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.flag-green { background: rgba(45, 212, 160, 0.85); box-shadow: 0 0 8px rgba(45, 212, 160, 0.35); }
.flag-yellow { background: rgba(241, 196, 15, 0.85); }
.flag-red { background: rgba(199, 92, 110, 0.9); }

.empty-row td,
.cc-msg-cell {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  padding: 36px 16px !important;
}
.cc-msg-cell--err { color: #e8a0a8; }
.cc-msg-cell code { font-size: 0.92em; padding: 0.1em 0.35em; border-radius: 4px; background: rgba(0, 0, 0, 0.25); }
.cc-msg-cell strong { color: #f0c4c9; }

/* Chart detail */
#chartList { display: block; }
#chartDetail { display: none; }

.ch-photo-wrap { position: relative; flex-shrink: 0; cursor: pointer; }
.ch-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(0, 234, 255, 0.25);
  display: block;
}
.ch-photo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 1px solid rgba(80, 160, 145, 0.3);
  background: rgba(15, 181, 160, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ch-photo-placeholder svg {
  width: 28px;
  height: 28px;
  stroke: rgba(0, 234, 255, 0.3);
  fill: none;
  stroke-width: 1.5;
}
.ch-photo-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 26px;
  height: 26px;
  background: linear-gradient(145deg, rgba(196, 162, 78, 0.95), rgba(15, 181, 160, 0.85));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.ch-photo-edit svg { width: 11px; height: 11px; stroke: #06080f; fill: none; stroke-width: 2; }
.ch-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.flag-select,
.status-select {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  background-color: rgba(7, 10, 20, 0.75);
  border: 1px solid var(--gold-border);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 100px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%230fb5a0' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.flag-select:focus,
.status-select:focus {
  outline: none;
  border-color: rgba(15, 181, 160, 0.5);
  box-shadow: 0 0 0 2px rgba(15, 181, 160, 0.12);
}

.btn-print-chart,
.btn-delete-chart {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-print-chart {
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--gold-border);
}
.btn-print-chart:hover {
  color: var(--text);
  border-color: rgba(15, 181, 160, 0.4);
  background: rgba(15, 181, 160, 0.06);
}
.btn-delete-chart {
  color: rgba(199, 92, 110, 0.75);
  background: transparent;
  border: 1px solid rgba(199, 92, 110, 0.25);
}
.btn-delete-chart:hover {
  color: var(--coral);
  border-color: rgba(199, 92, 110, 0.5);
  background: rgba(199, 92, 110, 0.08);
}

/* Chart workspace — two columns: notes/invoices | scrolling chart data */
.chart-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px 28px;
  align-items: stretch;
  min-height: min(68vh, 760px);
}
.chart-workspace__col--left {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}
.chart-workspace__col--right {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chart-scroll-pane {
  flex: 1;
  min-height: min(64vh, 720px);
  max-height: min(72vh, 920px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 8px 12px 4px;
  margin: 0 -4px 0 0;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}
.chart-scroll-pane::-webkit-scrollbar {
  width: 8px;
}
.chart-scroll-pane::-webkit-scrollbar-thumb {
  background: rgba(80, 160, 145, 0.28);
  border-radius: 8px;
}
.chart-scroll-pane::-webkit-scrollbar-track {
  background: rgba(7, 10, 20, 0.35);
  border-radius: 8px;
}
.chart-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  min-height: 0;
}
.chart-panel--compose {
  flex-shrink: 0;
}
.chart-panel--list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chart-panel--list:not(.chart-panel--invoices) {
  flex: 1 1 260px;
}
.chart-panel--invoices {
  flex: 0 1 auto;
}
.chart-panel__title {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(15, 181, 160, 0.88);
  margin: 0 0 14px 0;
}
.chart-panel__scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 -4px 0 0;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
}
.chart-panel__scroll--notes {
  max-height: min(38vh, 460px);
}
.chart-panel__scroll--invoices {
  max-height: min(30vh, 360px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chart-section {
  margin-bottom: 22px;
}
.chart-section:last-child {
  margin-bottom: 0;
}
.chart-section__title {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber-lt);
  margin: 0 0 12px 0;
}
.chart-section__proto {
  margin-top: 8px;
}
.proto-save-cell {
  display: flex;
  align-items: flex-end;
}

.chart-section--stack {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -6px -6px 18px -6px;
  padding: 12px 10px 14px 10px;
  background: linear-gradient(180deg, rgba(9, 13, 24, 0.98) 0%, rgba(9, 13, 24, 0.94) 50%, rgba(9, 13, 24, 0.9) 100%);
  border: 1px solid rgba(80, 160, 145, 0.2);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}
.current-stack-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.current-stack-head .chart-section__title {
  margin-bottom: 0;
}
.current-stack-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-stack-edit,
.btn-stack-cancel {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 100px;
  cursor: pointer;
  border: 1px solid var(--gold-border);
  background: rgba(7, 10, 20, 0.55);
  color: var(--text-dim);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn-stack-edit:hover {
  color: var(--amber-lt);
  border-color: rgba(196, 162, 78, 0.45);
}
.btn-stack-cancel {
  border-color: rgba(199, 92, 110, 0.35);
  color: rgba(199, 92, 110, 0.88);
}
.current-stack-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 10px 0;
  max-width: 52ch;
}
.current-stack-hint strong {
  color: rgba(154, 179, 176, 0.95);
  font-weight: 600;
}
.current-stack-read {
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.55;
  color: rgba(200, 220, 216, 0.95);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(36vh, 320px);
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(80, 160, 145, 0.22);
  background: rgba(7, 10, 20, 0.45);
}
.current-stack-read--empty {
  color: var(--text-muted);
  font-style: italic;
}
.current-stack-textarea {
  min-height: 180px;
}

@media (max-width: 1024px) {
  .chart-workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .chart-scroll-pane {
    max-height: min(56vh, 720px);
    min-height: 320px;
  }
  .chart-panel__scroll--notes {
    max-height: min(32vh, 400px);
  }
}

/* Fields */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 28px;
  margin-bottom: 20px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
}
.df { margin-bottom: 4px; }
.df-label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 234, 255, 0.45);
  margin-bottom: 4px;
}
.df-value {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.55;
}
.df-value.empty { color: var(--text-muted); font-style: italic; }
.df-full { grid-column: 1 / -1; }

/* Protocol + notes cards */
.proto-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 16px;
  position: relative;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
}
.proto-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 234, 255, 0.25), rgba(196, 162, 78, 0.35), transparent);
  border-radius: 16px 16px 0 0;
}
.proto-label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber-lt);
  margin-bottom: 10px;
  display: block;
}
.proto-textarea,
.proto-input,
.note-input {
  width: 100%;
  background: rgba(7, 10, 20, 0.55);
  border: 1px solid rgba(80, 160, 145, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.proto-textarea { min-height: 100px; resize: vertical; }
.proto-textarea:focus,
.proto-input:focus,
.note-input:focus {
  border-color: rgba(15, 181, 160, 0.45);
  box-shadow: 0 0 0 2px rgba(15, 181, 160, 0.08);
}
.proto-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.btn-save {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 22px;
  border: 1px solid rgba(15, 181, 160, 0.45);
  border-radius: 100px;
  cursor: pointer;
  color: var(--emerald);
  background: linear-gradient(165deg, rgba(15, 181, 160, 0.22), rgba(15, 181, 160, 0.08));
  box-shadow: 0 4px 20px rgba(15, 181, 160, 0.12);
  transition: all 0.2s;
}
.btn-save:hover {
  border-color: rgba(0, 234, 255, 0.5);
  box-shadow: 0 6px 28px rgba(15, 181, 160, 0.2);
}

.note-input-wrap {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.note-flag-select {
  font-family: var(--font-ui);
  font-size: 11px;
  background-color: rgba(7, 10, 20, 0.75);
  border: 1px solid var(--gold-border);
  color: var(--text);
  padding: 12px 10px;
  border-radius: 10px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.note-flag-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  align-self: stretch;
}
.note-flag-bar {
  width: 3px;
  border-radius: 2px;
  flex: 1;
  min-height: 8px;
}
.note-flag-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.note-flag-icon svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.note-flag-bar.green { background: rgba(45, 212, 160, 0.65); }
.note-flag-bar.yellow { background: rgba(241, 196, 15, 0.65); }
.note-flag-bar.red { background: rgba(199, 92, 110, 0.7); }
.note-body { flex: 1; min-width: 0; }
.note-text {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 6px;
}
.note-lab-attach {
  margin: 8px 0 4px;
}
.note-lab-attach a {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
}
.note-lab-attach a:hover {
  text-decoration: underline;
}
.note-date {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.note-delete {
  background: none;
  border: none;
  color: rgba(199, 92, 110, 0.45);
  cursor: pointer;
  padding: 2px;
  transition: color 0.2s;
}
.note-delete:hover { color: var(--coral); }

.cc-empty-note {
  text-align: center;
  padding: 32px 16px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* Invoices */
.inv-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.inv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.inv-card-num {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--amber-lt);
}
.inv-card-date {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
}
.inv-card-status {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 100px;
}
.inv-status-paid {
  background: rgba(45, 212, 160, 0.12);
  color: var(--emerald);
  border: 1px solid rgba(45, 212, 160, 0.22);
}
.inv-status-unpaid {
  background: rgba(241, 196, 15, 0.1);
  color: #e8c97a;
  border: 1px solid rgba(241, 196, 15, 0.2);
}
.inv-status-pending {
  background: rgba(196, 162, 78, 0.08);
  color: var(--text-dim);
  border: 1px solid var(--gold-border);
}
.inv-card-items {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.85;
  margin-bottom: 12px;
}
.inv-card-items span {
  font-size: 11px;
  color: var(--text-muted);
}
.inv-card-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}
.inv-card-total-label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.inv-card-total-val {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--amber-lt);
  text-shadow: 0 0 24px rgba(196, 162, 78, 0.2);
}
.inv-card-notes {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  font-style: italic;
}
.inv-loading-msg {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  padding: 20px 0;
  text-align: center;
}

/* Lightbox */
.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.94);
  z-index: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  backdrop-filter: blur(12px);
  cursor: pointer;
}
.photo-lightbox.open { display: flex; }
.photo-lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border: 1px solid rgba(0, 234, 255, 0.25);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
  border-radius: 8px;
}
.photo-lightbox-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  max-width: min(360px, calc(100vw - 40px));
  background: linear-gradient(165deg, rgba(18, 24, 44, 0.98), rgba(8, 11, 22, 0.99));
  border: 1px solid rgba(80, 160, 145, 0.35);
  padding: 14px 20px;
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  z-index: 600;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s var(--cc-ease);
  pointer-events: none;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, transparent, rgba(15, 181, 160, 0.8), rgba(196, 162, 78, 0.7), transparent);
}

/* Delete modal */
.delete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.92);
  z-index: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(10px);
}
.delete-overlay.open { display: flex; }
.delete-modal {
  background: linear-gradient(165deg, rgba(18, 24, 44, 0.98), rgba(8, 11, 22, 0.99));
  border: 1px solid rgba(199, 92, 110, 0.35);
  width: 100%;
  max-width: 480px;
  padding: 32px 28px;
  position: relative;
  text-align: center;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
}
.delete-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, transparent, rgba(199, 92, 110, 0.65), transparent);
}
.delete-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(199, 92, 110, 0.35);
  background: rgba(199, 92, 110, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.delete-icon svg {
  width: 22px;
  height: 22px;
  stroke: rgba(199, 92, 110, 0.85);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.delete-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
  margin-bottom: 6px;
}
.delete-name {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  color: rgba(232, 145, 158, 0.95);
  margin-bottom: 14px;
}
.delete-warning {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
  margin-bottom: 22px;
  text-align: left;
}
.delete-warning strong { color: #e8919e; }
.delete-label {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(199, 92, 110, 0.65);
  display: block;
  margin-bottom: 8px;
  text-align: left;
}
.delete-input {
  width: 100%;
  background: rgba(7, 10, 20, 0.75);
  border: 1px solid rgba(199, 92, 110, 0.25);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--text);
  outline: none;
  text-align: center;
  margin-bottom: 18px;
}
.delete-input:focus {
  border-color: rgba(199, 92, 110, 0.5);
  box-shadow: 0 0 0 2px rgba(199, 92, 110, 0.1);
}
.delete-input::placeholder { color: var(--text-muted); }
.delete-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-confirm-delete {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  padding: 12px 26px;
  border: none;
  background: rgba(199, 92, 110, 0.8);
  border-radius: 100px;
  cursor: pointer;
  opacity: 0.35;
  pointer-events: none;
  transition: all 0.2s;
}
.btn-confirm-delete.enabled {
  opacity: 1;
  pointer-events: auto;
}
.btn-confirm-delete.enabled:hover {
  background: rgba(199, 92, 110, 0.95);
  box-shadow: 0 4px 24px rgba(199, 92, 110, 0.35);
}
.btn-cancel-delete {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--gold-border);
  padding: 12px 22px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel-delete:hover {
  color: var(--text);
  border-color: rgba(15, 181, 160, 0.35);
}

/* Footer */
.admin-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--divider);
  padding: 18px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 24px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.admin-footer__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-footer a {
  color: rgba(0, 234, 255, 0.45);
  transition: color 0.2s;
}
.admin-footer a:hover { color: var(--emerald); }
.admin-footer .btn-out {
  text-decoration: none;
}

/* Skeleton */
.skel-row td { padding: 14px 12px; }
.skel-bar {
  height: 10px;
  border-radius: 4px;
  background: rgba(15, 181, 160, 0.06);
  position: relative;
  overflow: hidden;
}
.skel-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 234, 255, 0.1), transparent);
  animation: skelPulse 1.5s infinite;
}
@keyframes skelPulse { to { left: 100%; } }
.skel-w60 { width: 60%; }
.skel-w40 { width: 40%; }
.skel-w30 { width: 30%; }
.skel-w50 { width: 50%; }

/* Focus */
:where(button, a, input, textarea, select):focus-visible {
  outline: 2px solid rgba(0, 234, 255, 0.65);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .admin-main { padding: 24px 16px 56px; }
  .chart-workspace { gap: 18px; }
  .chart-panel__scroll--notes { max-height: min(42vh, 380px); }
  .chart-panel__scroll--invoices { max-height: min(34vh, 300px); }
  .detail-grid { grid-template-columns: 1fr; }
  .proto-row { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-directory { align-items: center; }
  .search-box { max-width: 100%; }
  .toolbar-directory .search-box-directory {
    max-width: 100%;
  }
  .note-input-wrap { flex-direction: column; align-items: stretch; }
  .pending-intakes-row { flex-direction: column; align-items: stretch; }
  .pending-intakes-row-actions { width: 100%; justify-content: stretch; }
  .btn-pending-create,
  .btn-pending-delete { flex: 1 1 auto; text-align: center; justify-content: center; }
}

@media (max-width: 400px) {
  .admin-main {
    padding: 20px 12px 56px;
  }
  .page-title {
    font-size: clamp(22px, 6.5vw, 34px);
  }
  .chart-scroll-pane {
    min-height: 280px;
  }
}

/* Print */
@media print {
  body { background: #fff !important; color: #1a1208 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 0.4in; size: portrait; }
  .cc-atmosphere,
  .records-app-shell::before,
  .admin-topbar,
  .admin-footer,
  #loginGate,
  #chartList,
  .chart-back-dir,
  .client-records-banner .cc-hero-img,
  .client-records-banner .mbr-banner-scrim,
  .client-records-banner .cc-hero-overlay,
  .client-records-banner .cc-hero-tint,
  .client-records-banner .cc-hero-bottom-line,
  .client-records-banner .cc-hero-return,
  .ch-actions,
  .note-input-wrap,
  .note-delete,
  .proto-textarea,
  .proto-input,
  .btn-save,
  .btn-print-chart,
  .btn-delete-chart,
  .toast,
  .photo-lightbox,
  .delete-overlay,
  select { display: none !important; }
  #adminContent { display: block !important; }
  .admin-main { padding: 0 !important; max-width: 100%; }
  .client-records-banner.records-cc-hero {
    min-height: 0 !important;
    height: auto !important;
    border: none !important;
    background: #fff !important;
    padding: 0 0 12px !important;
    margin-bottom: 12px !important;
    border-bottom: 2px solid #b8924a !important;
    page-break-inside: avoid;
  }
  .client-records-banner .client-records-banner__content {
    margin: 0 !important;
    padding: 0 !important;
    align-items: flex-start !important;
    text-align: left !important;
  }
  .client-records-banner__eyebrow {
    color: #6a5a42 !important;
    font-size: 10px !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    margin-bottom: 4px !important;
  }
  .client-records-banner__name--hero {
    color: #1a1208 !important;
    font-size: 24px !important;
    text-shadow: none !important;
    margin-bottom: 10px !important;
  }
  .client-records-banner__identity {
    justify-content: flex-start !important;
    gap: 0.75rem !important;
  }
  .client-records-banner__demo {
    text-align: left !important;
  }
  .banner-demo-label {
    color: #6a5a42 !important;
  }
  .banner-demo-val {
    color: #1a1208 !important;
  }
  .ch-photo { width: 60px !important; height: 60px !important; border-color: #b8924a !important; }
  .current-stack-head-actions,
  .current-stack-hint,
  #currentStackEditWrap {
    display: none !important;
  }
  .chart-section--stack {
    position: static !important;
    box-shadow: none !important;
    background: #faf6ed !important;
    border: 1px solid #e8e0d0 !important;
    page-break-inside: avoid;
  }
  .current-stack-read {
    max-height: none !important;
    border: 1px solid #e8e0d0 !important;
    background: #fff !important;
    color: #1a1208 !important;
  }
  .chart-workspace {
    display: block !important;
    min-height: 0 !important;
  }
  .chart-scroll-pane {
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .chart-panel__scroll {
    max-height: none !important;
    overflow: visible !important;
  }
  .chart-section {
    display: block !important;
    page-break-inside: avoid;
    margin-bottom: 16px;
    border-top: 1px solid #d4c4a0;
    padding-top: 12px;
    background: none !important;
  }
  .chart-section__title {
    font-family: Georgia, serif !important;
    font-size: 16px !important;
    color: #b8924a !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    text-transform: none !important;
    margin-bottom: 8px !important;
  }
  .chart-panel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 16px;
    border-top: 1px solid #d4c4a0;
    padding: 12px 0 0 0 !important;
  }
  .chart-panel__title {
    font-family: Georgia, serif !important;
    font-size: 16px !important;
    color: #b8924a !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    text-transform: none !important;
    margin-bottom: 8px !important;
  }
  .detail-grid {
    gap: 8px !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
  }
  .df-value { color: #1a1208 !important; }
  .df-label { color: #6a5a42 !important; }
  .proto-card {
    border: 1px solid #e8e0d0 !important;
    background: #faf6ed !important;
    page-break-inside: avoid;
  }
  .note-card {
    border: 1px solid #e8e0d0 !important;
    page-break-inside: avoid;
    background: #fff !important;
  }
  .note-text { color: #1a1208 !important; }
  .note-date { color: #6a5a42 !important; }
  .note-flag-bar.green { background: #27ae60 !important; }
  .note-flag-bar.yellow { background: #f1c40f !important; }
  .note-flag-bar.red { background: #c0392b !important; }
  #chartDetail::after {
    content: 'Coleman & Co. — Confidential Client Chart — Printed ' attr(data-print-date);
    display: block;
    text-align: center;
    font-family: var(--font-ui), system-ui, sans-serif;
    font-size: 8px;
    letter-spacing: 0.12em;
    color: #b8924a;
    border-top: 1px solid #d4c4a0;
    padding-top: 8px;
    margin-top: 24px;
  }
}
