/* ========================================================================
   Vitae — AI Resume Studio
   Design Language: Luxury Dark Editorial, Newsreader Typography,
   Obsidian Canvas, Cream Radiance, and Handcrafted Terracotta Rust.
   ======================================================================== */

/* ---- Design Tokens ----------------------------------------------------- */
:root {
  /* Surfaces (Warm Obsidian Dark Palette matching Vitae-Splash) */
  --bg: #1E1B16;
  --bg-canvas: #14120E;
  --bg-surface: #1E1B16;
  --bg-elevated: #25211B;
  --bg-card: #2B2620;
  --bg-card-hover: #342F27;
  --bg-card-active: #3C362D;
  --bg-input: #171511;
  --bg-input-focus: #1E1B15;
  --bg-glass: rgba(30, 27, 22, 0.78);
  --bg-glass-strong: rgba(26, 23, 19, 0.92);

  /* Cream & Sand Typography */
  --cream: #FCF9F2;
  --cream-soft: #DDD4C4;
  --cream-muted: #9E9585;
  --cream-faint: #635D50;
  --cream-border: rgba(252, 249, 242, 0.08);

  /* Signature Terracotta Rust Accents */
  --rust: #8F4435;
  --rust-glow: #B85643;
  --rust-hover: #A34E3E;
  --rust-light: #F2A080;
  --rust-tint: rgba(143, 68, 53, 0.18);
  --rust-tint-strong: rgba(143, 68, 53, 0.28);
  --rust-border: rgba(143, 68, 53, 0.42);

  /* Functional Accents */
  --accent-green: #3E8A5E;
  --accent-green-hover: #4CA571;
  --accent-green-tint: rgba(62, 138, 94, 0.18);
  --accent-amber: #C98B32;
  --accent-amber-tint: rgba(201, 139, 50, 0.18);
  --danger: #C04444;
  --danger-hover: #D65252;
  --danger-tint: rgba(192, 68, 68, 0.18);

  /* Hairline Rules & Borders */
  --rule: rgba(252, 249, 242, 0.08);
  --rule-medium: rgba(252, 249, 242, 0.14);
  --rule-hover: rgba(252, 249, 242, 0.22);
  --rule-strong: rgba(252, 249, 242, 0.32);

  /* Fonts */
  --logo-font: 'Newsreader', Georgia, 'Times New Roman', serif;
  --serif: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sans: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Geometry */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-md: 14px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Dimensions */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;
  --mobile-header-h: 58px;
  --mobile-tabs-h: 66px;
  --toolbar-item-h: 36px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Elevation Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(143, 68, 53, 0.35);
  --shadow-paper: 0 14px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.2);

  /* Micro-Interactions */
  --transition-fast: 120ms ease;
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 350ms cubic-bezier(0.16, 1, 0.3, 1);
  --ring: 0 0 0 3px rgba(143, 68, 53, 0.25);
}

/* Light Theme Tokens */
[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-canvas: #F4F6F9;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F9FAFB;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8F9FA;
  --bg-card-active: #F1F3F5;
  --bg-input: #FFFFFF;
  --bg-input-focus: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --bg-glass-strong: rgba(255, 255, 255, 0.98);

  --cream: #18191C;
  --cream-soft: #4B5262;
  --cream-muted: #717786;
  --cream-faint: #9EA5B3;
  --cream-border: rgba(0, 0, 0, 0.08);

  --rust: #9E4A3B;
  --rust-glow: #B85643;
  --rust-hover: #8F4435;
  --rust-light: #B85643;
  --rust-tint: rgba(158, 74, 59, 0.1);
  --rust-tint-strong: rgba(158, 74, 59, 0.18);
  --rust-border: rgba(158, 74, 59, 0.28);

  --accent-green: #2B7A4B;
  --accent-green-hover: #23653E;
  --accent-green-tint: rgba(43, 122, 75, 0.12);
  --accent-amber: #B87920;
  --accent-amber-tint: rgba(184, 121, 32, 0.12);
  --danger: #C03838;
  --danger-hover: #A62F2F;
  --danger-tint: rgba(192, 56, 56, 0.1);

  --rule: #E5E7EB;
  --rule-medium: #D1D5DB;
  --rule-hover: #9CA3AF;
  --rule-strong: #6B7280;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.09), 0 4px 8px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 16px rgba(158, 74, 59, 0.2);
  --shadow-paper: 0 8px 30px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* ---- Reset & Base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.nav-item[hidden],
.tab-item[hidden] { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
html {
  height: 100%;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden !important;
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
html[data-theme="light"] {
  color-scheme: light;
}
body {
  height: 100%;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  background-color: var(--bg-canvas);
  background-image:
    radial-gradient(120% 100% at 50% 0%, #231F19 0%, var(--bg-canvas) 60%),
    radial-gradient(100% 80% at 50% 100%, #1A1713 0%, var(--bg-canvas) 80%);
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden !important;
}
[data-theme="light"] body {
  background-image: none;
  background-color: #F4F6F9;
}

/* Subtle editorial noise grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.035;
  z-index: 1;
  mix-blend-mode: overlay;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--cream);
  margin: 0;
}
button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--cream);
}
a {
  color: inherit;
  text-decoration: none;
}
::selection {
  background: var(--rust);
  color: #fff;
}
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
:focus-visible:not(input):not(textarea):not(select) {
  outline: 2px solid var(--rust-light);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

/* ========================================================================
   STARTUP SPLASH SCREEN ENGINE
   (Incorporates exact physics, Newsreader typography & Canvas trails)
   ======================================================================== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 100% at 49% 52%, #211e19 0%, #1e1b16 55%, #14120e 100%), #14120e !important;
  color: #FCF9F2 !important;
  overflow: hidden;
  transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1), transform 700ms cubic-bezier(0.16, 1, 0.3, 1), filter 700ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform, filter;
}

.splash-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(143, 68, 53, 0.12) 0%, transparent 65%) !important;
}

.splash-grain {
  content: "";
  position: absolute;
  inset: -50%;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.splash-screen .word {
  position: fixed;
  left: 49%;
  top: 51.2%;
  transform: translate(-50%, -50%);
  margin: 0;
  font: 700 clamp(44px, 7.5vw, 172px) / 1 var(--logo-font);
  letter-spacing: -0.045em;
  color: #FCF9F2 !important;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  user-select: none;
  z-index: 2;
}

.splash-screen .word span {
  display: inline-block;
  opacity: 0;
  will-change: transform, opacity, filter, color;
}

.splash-screen .dot {
  display: inline-block;
  width: 0.19em;
  height: 0.19em;
  margin-left: 0.09em;
  visibility: hidden;
}

.splash-screen canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

/* Screen reader text */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Floating Bottom Controls HUD */
.splash-hud {
  position: fixed;
  bottom: calc(36px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  opacity: 0;
  animation: splashHudFadeIn 900ms 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes splashHudFadeIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.splash-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(30, 27, 22, 0.7);
  border: 1px solid var(--rule);
  border-radius: var(--radius-full);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--cream-soft);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.splash-status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rust-light);
  box-shadow: 0 0 10px var(--rust-light);
  animation: pulseDot 1.6s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.splash-skip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(252, 249, 242, 0.06);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-full);
  color: var(--cream-soft);
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition);
}

.splash-skip-btn:hover {
  background: rgba(252, 249, 242, 0.12);
  border-color: var(--rule-hover);
  color: var(--cream);
  transform: translateX(2px);
}

.splash-skip-btn svg {
  transition: transform var(--transition);
}
.splash-skip-btn:hover svg {
  transform: translateX(2px);
}

/* Exit Transition for Splash */
.splash-screen.is-exiting {
  opacity: 0;
  transform: scale(1.025);
  filter: blur(12px);
  pointer-events: none;
}

/* ========================================================================
   APP SHELL & GLOBAL LAYOUT
   ======================================================================== */
.app-shell {
  --sb: var(--sidebar-w);
  display: flex;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden !important;
  position: relative;
  z-index: 2;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1), transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-shell.app-ready {
  opacity: 1;
  transform: translateY(0);
}

.app-shell.sb-collapsed {
  --sb: var(--sidebar-w-collapsed);
}

.app-shell > main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sb);
  width: calc(100% - var(--sb));
  max-width: calc(100% - var(--sb));
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transition: margin-left 240ms cubic-bezier(0.16, 1, 0.3, 1),
              width 240ms cubic-bezier(0.16, 1, 0.3, 1),
              max-width 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.is-auth-screen {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
}

.app-shell.is-auth {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  overflow: hidden !important;
}

.app-shell.is-auth > main {
  display: block !important;
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scroll-behavior: smooth;
}

.app-shell.is-auth > main:has(.auth-wrap) {
  display: flex !important;
  flex-direction: column;
  overflow: hidden !important;
}

/* ---- Brand Identifiers ------------------------------------------------- */
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--cream);
  transition: opacity var(--transition);
}
.brand-link:hover { opacity: 0.9; }

.brand-name {
  font-family: var(--logo-font);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--cream);
}
.brand-dot {
  color: var(--rust-light);
  display: inline-block;
  margin-left: 1px;
}
.brand-initial {
  display: none;
  font-family: var(--logo-font);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--cream);
}

.brand-block { min-width: 0; }
.brand-tagline {
  display: block;
  font-size: 0.65rem;
  color: var(--cream-muted);
  margin-top: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  white-space: nowrap;
}

.beta-tag {
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 3px 7px;
  border-radius: var(--radius-full);
  color: var(--rust-light);
  background: var(--rust-tint);
  border: 1px solid var(--rust-border);
  text-transform: uppercase;
}

/* ---- Desktop Sidebar (Warm Editorial Dark Palette) ------------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sb);
  min-width: var(--sb);
  max-width: var(--sb);
  height: 100vh;
  height: 100dvh;
  background: #1C1A16 !important;
  border-right: 1px solid rgba(255, 253, 248, 0.08) !important;
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-x: hidden;
  overflow-y: hidden;
  box-sizing: border-box;
  transition: width 240ms cubic-bezier(0.16, 1, 0.3, 1),
              min-width 240ms cubic-bezier(0.16, 1, 0.3, 1),
              max-width 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 16px 20px;
  border-bottom: 1px solid rgba(255, 253, 248, 0.08) !important;
  height: 64px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.brand-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  gap: 8px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: var(--cream);
  outline: none !important;
}
.brand-link:focus,
.brand-link:focus-visible {
  outline: none !important;
}

.brand-logo {
  height: 24px;
  width: auto;
  max-width: 110px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.sidebar .brand-logo {
  height: 24px;
  width: auto;
  max-width: 110px;
  object-fit: contain;
  display: block !important;
  flex-shrink: 0;
}

.brand-initial {
  display: none;
  font-family: var(--logo-font);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
  color: #FCF9F2;
  text-align: center;
  user-select: none;
}
.brand-initial .brand-dot {
  color: var(--rust-light);
}

.sidebar .beta-badge-btn {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--rust-border);
  background: var(--rust-tint);
  color: var(--rust-light);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar .beta-badge-btn:hover {
  background: var(--rust-tint-strong);
  border-color: var(--rust-glow);
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(184, 86, 67, 0.35);
}

.sidebar-toggle, .btn-icon-sm {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: var(--radius-sm);
  color: #A8A194 !important;
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-toggle:hover, .btn-icon-sm:hover {
  background: rgba(255, 253, 248, 0.07) !important;
  color: #FCF9F2 !important;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  color: #A8A194 !important;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  border: none !important;
  box-sizing: border-box;
  flex-shrink: 0;
}
.nav-item svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex-shrink: 0;
  opacity: 0.75;
  color: inherit !important;
  display: block;
  transition: opacity var(--transition);
}
.nav-item .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item:hover {
  background: rgba(255, 253, 248, 0.06) !important;
  color: #FCF9F2 !important;
}
.nav-item:hover svg {
  opacity: 1;
}

.nav-item.active {
  background: rgba(255, 253, 248, 0.1) !important;
  color: #FFFFFF !important;
  font-weight: 600;
}
.nav-item.active svg {
  opacity: 1;
  color: inherit !important;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid rgba(255, 253, 248, 0.08) !important;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.18) !important;
  flex-shrink: 0;
}

.sidebar-foot-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  color: #A8A194 !important;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: none !important;
  transition: background var(--transition), color var(--transition);
  box-sizing: border-box;
  flex-shrink: 0;
}
.sidebar-foot-item svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex-shrink: 0;
  opacity: 0.75;
  color: inherit !important;
  display: block;
  transition: opacity var(--transition);
}
.sidebar-foot-item .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-foot-item:hover {
  background: rgba(255, 253, 248, 0.06) !important;
  color: #FCF9F2 !important;
}
.sidebar-foot-item.active {
  background: rgba(255, 253, 248, 0.1) !important;
  color: #FFFFFF !important;
  font-weight: 600;
}
.sidebar-foot-item:hover svg,
.sidebar-foot-item.active svg {
  opacity: 1;
}

.sidebar-toggle-btn .toggle-icon {
  transition: transform var(--transition);
}

/* Collapsed Sidebar Rail */
.sb-collapsed .sidebar-head {
  padding: 14px 0;
  justify-content: center;
}
.sb-collapsed .brand-block {
  justify-content: center;
  width: 100%;
}
.sb-collapsed .sidebar .brand-name,
.sb-collapsed .sidebar .brand-tagline,
.sb-collapsed .sidebar .beta-tag,
.sb-collapsed .sidebar .beta-badge-btn,
.sb-collapsed .sidebar .nav-label,
.sb-collapsed .sidebar .brand-logo {
  display: none !important;
}
.sb-collapsed .sidebar .brand-initial {
  display: block !important;
}
.sb-collapsed .sidebar-nav {
  padding: 12px 0;
  align-items: center;
}
.sb-collapsed .nav-item {
  justify-content: center;
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
}
.sb-collapsed .sidebar-foot {
  padding: 12px 0;
  align-items: center;
}
.sb-collapsed .sidebar-foot-item {
  justify-content: center;
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
}
.sb-collapsed .sidebar-toggle-btn .toggle-icon {
  transform: scaleX(-1);
}

.sidebar a:focus-visible,
.sidebar button:focus-visible {
  outline: 2px solid var(--rust-light) !important;
  outline-offset: -2px !important;
}
.sidebar .brand-link:focus,
.sidebar .brand-link:focus-visible {
  outline: none !important;
}

/* ---- Mobile Top Header ------------------------------------------------- */
.mobile-header {
  display: none;
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--mobile-header-h) + var(--safe-top));
  padding: var(--safe-top) 18px 0;
  background: var(--bg-glass-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--rule);
  align-items: center;
  justify-content: space-between;
  z-index: 40;
}
.mobile-brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-header-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-medium);
  background: var(--bg-surface);
  color: var(--cream);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
  flex-shrink: 0;
  font-size: 0 !important;
  line-height: 0 !important;
  overflow: hidden !important;
}
.mobile-icon-btn svg {
  display: block !important;
  flex-shrink: 0 !important;
  pointer-events: none !important;
  margin: auto !important;
}
.mobile-icon-btn:hover {
  border-color: var(--rust-border);
  color: var(--rust-light);
  background: rgba(252, 249, 242, 0.06);
}
.mobile-icon-btn.active {
  background: var(--rust-tint);
  border-color: var(--rust-border);
  color: var(--rust-light);
}
.mobile-icon-btn.is-dirty {
  border-color: rgba(229, 164, 64, 0.6) !important;
  background: rgba(229, 164, 64, 0.12) !important;
  color: #FBBF24 !important;
}
.mobile-icon-btn.is-dirty:hover {
  border-color: #E5A440 !important;
  background: rgba(229, 164, 64, 0.2) !important;
}
.mobile-dl-dropdown {
  position: relative;
}
.mobile-dl-dropdown .download-menu {
  top: calc(100% + 8px);
  right: 0;
  left: auto;
}

[data-theme="light"] .mobile-icon-btn {
  background: #FFFFFF;
  border-color: #E2E8F0;
  color: #0F172A;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .mobile-icon-btn:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: var(--rust);
}
[data-theme="light"] .mobile-icon-btn.active {
  background: rgba(143, 68, 53, 0.08);
  border-color: rgba(143, 68, 53, 0.25);
  color: var(--rust);
}
[data-theme="light"] .mobile-icon-btn.is-dirty {
  border-color: #D97706 !important;
  background: #FEF3C7 !important;
  color: #92400E !important;
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.mobile-dropdown-email {
  display: block;
  font-size: 0.8rem;
  color: var(--cream-soft);
  margin-bottom: 12px;
  word-break: break-all;
  font-weight: 500;
}

/* ---- Mobile Bottom Tab Bar --------------------------------------------- */
.mobile-tabs {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  height: calc(var(--mobile-tabs-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-glass-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--rule);
  justify-content: space-around;
  align-items: stretch;
  z-index: 40;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--cream-muted);
  font-size: 0.72rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition);
}
.tab-item.active {
  color: var(--rust-light);
}

/* ---- Shared Buttons (Compact, Completely Rounded Pills) ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 15px;
  border-radius: var(--radius-full);
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--rule-medium);
  background: rgba(252, 249, 242, 0.05);
  color: var(--cream);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  text-decoration: none;
}
[data-theme="light"] .btn {
  background: #F3F4F6;
  border-color: #D1D5DB;
  color: #1F2937;
}
.btn:hover {
  background: rgba(252, 249, 242, 0.1);
  border-color: var(--rule-hover);
  transform: translateY(-1px);
}
[data-theme="light"] .btn:hover {
  background: #E5E7EB;
  border-color: #9CA3AF;
  color: #111827;
}
.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(135deg, var(--rust), #9E4A3B);
  border-color: var(--rust-border);
  color: #fff;
  box-shadow: 0 2px 8px rgba(143, 68, 53, 0.3);
}
.btn.primary:hover {
  background: linear-gradient(135deg, var(--rust-hover), var(--rust));
  border-color: var(--rust-light);
  box-shadow: 0 4px 14px rgba(143, 68, 53, 0.45);
}

.btn.secondary {
  background: rgba(252, 249, 242, 0.05);
  border-color: var(--rule-medium);
  color: var(--cream);
}
[data-theme="light"] .btn.secondary {
  background: #FFFFFF;
  border-color: #D1D5DB;
  color: #1F2937;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--cream-soft);
  box-shadow: none;
}
.btn.ghost:hover {
  background: rgba(252, 249, 242, 0.06);
  border-color: var(--rule);
  color: var(--cream);
}
[data-theme="light"] .btn.ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: #E5E7EB;
  color: #111827;
}

.btn.danger {
  color: #f7a8a8;
  background: var(--danger-tint);
  border-color: rgba(192, 68, 68, 0.3);
}
.btn.danger:hover {
  background: rgba(192, 68, 68, 0.3);
  border-color: rgba(192, 68, 68, 0.5);
  color: #fff;
}

.btn.small {
  height: 28px;
  padding: 0 12px;
  font-size: 0.77rem;
  border-radius: var(--radius-full);
}
.btn.full { width: 100%; }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.download-btn {
  height: 34px !important;
  border-radius: var(--radius-full) !important;
  background: linear-gradient(135deg, var(--accent-green), #32754D) !important;
  border-color: rgba(62, 138, 94, 0.45) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(62, 138, 94, 0.3);
}
.download-btn:hover {
  background: linear-gradient(135deg, var(--accent-green-hover), var(--accent-green)) !important;
  box-shadow: 0 4px 14px rgba(62, 138, 94, 0.45);
}

/* ---- Input Controls ---------------------------------------------------- */
.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--cream);
  transition: all var(--transition);
}
.input::placeholder { color: var(--cream-faint); }
.input:focus,
.input:focus-visible {
  outline: none !important;
  background: var(--bg-input-focus);
  border-color: var(--rule-medium) !important;
  box-shadow: none !important;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 6px;
}
.input-icon-wrap .input {
  padding-left: 38px;
}
.input-icon {
  position: absolute;
  left: 12px;
  color: var(--cream-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.field-error {
  color: #fca5a5;
  font-size: 0.82rem;
  min-height: 1.2em;
  margin: 6px 0 0;
}
.field-success {
  color: #86efac;
  font-size: 0.82rem;
  min-height: 1.2em;
  margin: 6px 0 0;
}
.lede {
  color: var(--cream-soft);
  margin: 8px 0 20px;
  font-size: 0.92rem;
  max-width: 68ch;
  line-height: 1.6;
}
.page-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rust-light);
  margin-bottom: 6px;
}

/* ========================================================================
   AUTH SCREEN (Enterprise Non-Scrollable Layout)
   ======================================================================== */
.auth-wrap {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  position: relative;
  background: var(--bg);
}

.auth-story {
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(90% 70% at 20% 25%, rgba(143, 68, 53, 0.16) 0%, transparent 60%),
    radial-gradient(80% 60% at 85% 75%, #231C16 0%, #161410 80%),
    #161410 !important;
  color: #FCF9F2 !important;
  padding: clamp(28px, 4.5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  border-right: 1px solid rgba(255, 253, 248, 0.08) !important;
}

.auth-brand {
  position: absolute;
  top: clamp(28px, 4.5vw, 64px);
  left: clamp(28px, 4.5vw, 64px);
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-brand .brand-name {
  font-size: 1.5rem;
  color: #FCF9F2 !important;
}

.auth-story-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 520px;
  margin: 0;
}

.auth-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #F2A080 !important;
  margin-bottom: -4px;
}

.auth-story-body h1 {
  font-size: clamp(1.9rem, 3.2vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: #FCF9F2 !important;
  margin: 0;
}

.auth-pitch {
  margin: 0;
  font-size: clamp(0.92rem, 1.05vw, 1.02rem);
  line-height: 1.55;
  color: #DDD4C4 !important;
  max-width: 48ch;
}

.auth-perks {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-perks li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #DDD4C4 !important;
}
.auth-perks li svg {
  color: #F2A080 !important;
  flex-shrink: 0;
  margin-top: 2px;
}
.auth-perks li strong {
  color: #FCF9F2 !important;
  font-weight: 600;
}

.auth-story-foot {
  display: none;
}

.auth-panel {
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3.5vw, 48px);
  background: var(--bg-canvas);
}

.auth-mobile-brand {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 18px;
  text-align: center;
}
.auth-mobile-brand .brand-name {
  font-size: 1.6rem;
}
.auth-mobile-tagline {
  margin: 0;
  font-size: 0.78rem;
  color: var(--rust-light);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-form-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-xl);
  padding: clamp(28px, 3.8vh, 42px) clamp(24px, 2.8vw, 34px);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}

.auth-form-box h2 {
  font-size: clamp(1.4rem, 1.8vw, 1.65rem);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  text-align: center;
}

.auth-form-box .lede {
  margin: 0 auto clamp(16px, 2.4vh, 22px);
  max-width: 32ch;
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: center;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  margin-bottom: clamp(14px, 2vh, 20px);
}

.tab {
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--cream-muted);
  font-weight: 600;
  font-size: 0.84rem;
  transition: all var(--transition);
}

.tab.active {
  background: var(--bg-card);
  color: var(--cream);
  box-shadow: var(--shadow-sm);
}

#authForm {
  display: flex;
  flex-direction: column;
  width: 100%;
}

#authForm label:not(.auth-consent-label) {
  display: block;
  text-align: left;
  margin-bottom: clamp(10px, 1.6vh, 16px);
  font-size: 0.8rem;
  color: var(--cream-soft);
  font-weight: 600;
}

#authForm .input {
  height: 42px;
  font-size: 0.88rem;
}

#authForm .auth-consent-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 12px 0 18px;
  padding: 2px 0;
  width: 100%;
  cursor: pointer;
  user-select: none;
  font-size: 0.785rem;
  font-weight: 400;
  color: var(--cream-soft);
  text-align: left;
  line-height: 1.35;
}

#authForm .auth-consent-label input[type="checkbox"] {
  appearance: auto;
  accent-color: var(--rust);
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

#authForm .consent-text {
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  text-align: left;
}

@media (max-width: 420px) {
  #authForm .auth-consent-label {
    align-items: flex-start;
  }
  #authForm .auth-consent-label input[type="checkbox"] {
    margin-top: 2px;
  }
}

#authSubmit {
  height: 42px;
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-legal-link {
  color: var(--rust-light);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color var(--transition);
}

.auth-legal-link:hover {
  color: var(--rust);
}

[data-theme="light"] .auth-legal-link {
  color: var(--rust);
}

.auth-legal-foot {
  display: none;
}

.auth-subtle-link {
  color: var(--cream-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.auth-subtle-link:hover {
  color: var(--cream);
  text-decoration: underline;
}

.auth-dot-sep {
  color: var(--cream-faint);
  user-select: none;
}

.auth-note {
  margin: clamp(12px, 1.8vh, 18px) 0 0;
  font-size: 0.74rem;
  color: var(--cream-faint);
  text-align: center;
}

/* ========================================================================
   COMPOSER / NEW RESUME SCREEN (Minimalist Enterprise Flow)
   ======================================================================== */
.compose-wrap, .library-screen, .settings-screen {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px clamp(20px, 4vw, 56px) 64px;
}

.page-head, .library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}
.page-head.minimal-head {
  align-items: center;
  flex-wrap: wrap;
}
.head-text { flex: 1; min-width: 280px; }
.page-head h1, .library-head h1 {
  font-size: 1.85rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.page-head .lede, .library-head .lede {
  margin: 0;
  font-size: 0.9rem;
}

/* ========================================================================
   SKETCH ACCURATE COMPOSER SCREEN (/new and /home)
   Pinpoint accurate layout matching the user's design:
   - Centered in the screen
   - Floating attached file preview cards directly above the input bar
   - Pill-shaped input bar with leading + button and clear placeholder
   - "Add Job Description" opens a refined popup dialog box
   ======================================================================== */
.sketch-composer-screen {
  width: 100%;
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
  position: relative;
  box-sizing: border-box;
}

.sketch-persistent-slot {
  width: 100%;
  max-width: 680px;
  margin-bottom: 24px;
}

.sketch-composer-wrap {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* ========================================================================
   SKETCH HERO & MACHINE ANIMATION (Document -> Machine -> Perfect Resume)
   ======================================================================== */
.sketch-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
  width: 100%;
  max-width: 580px;
  user-select: none;
}

.sketch-anim-wrap {
  width: clamp(380px, 46vw, 460px);
  max-width: 100%;
  aspect-ratio: 280 / 84;
  height: auto;
  margin-bottom: 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sketch-hero-title {
  font-family: var(--sans);
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 10px;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.sketch-hero-desc {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--cream-muted);
  margin: 0;
  max-width: 510px;
}

/* SVG Elements & Keyframes */
.sketch-anim-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Machine Chassis & Chamber */
.mach-chassis {
  fill: #221D19;
  stroke: rgba(143, 68, 53, 0.45);
  stroke-width: 1.25;
}
.mach-chassis-inner {
  fill: #191512;
  stroke: rgba(252, 249, 242, 0.05);
  stroke-width: 1;
}
.mach-viewport {
  fill: #100D0B;
  stroke: rgba(143, 68, 53, 0.3);
  stroke-width: 1;
}
.mach-glow-bg {
  fill: url(#chamberGlowGrad);
  opacity: 0.4;
  animation: machGlowPulse 3.6s ease-in-out infinite;
}
.mach-fin {
  stroke: rgba(252, 249, 242, 0.15);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.mach-hopper-chute {
  fill: #1E1915;
  stroke: rgba(143, 68, 53, 0.45);
  stroke-width: 1;
}
.mach-roller {
  fill: #2A231E;
  stroke: rgba(143, 68, 53, 0.5);
  stroke-width: 1;
}

/* Scanner Beam */
.mach-scan-beam {
  fill: url(#scanBeamGrad);
  animation: scanBeamSweep 3.6s ease-in-out infinite;
}

/* Central AI Core */
.mach-core-ring {
  fill: none;
  stroke: rgba(200, 109, 88, 0.4);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  animation: coreSpin 3.6s linear infinite;
  transform-origin: 140px 41px;
}
.mach-core-sparkle {
  fill: var(--rust-light);
  transform-origin: 140px 41px;
  animation: corePulse 3.6s ease-in-out infinite;
}

/* Status LEDs */
.mach-led {
  animation: ledBlink 3.6s step-end infinite;
}
.led-1 { fill: #22C55E; animation-delay: 0s; }
.led-2 { fill: #F59E0B; animation-delay: 0.4s; }
.led-3 { fill: var(--rust-light); animation-delay: 0.8s; }

.mach-brand {
  fill: rgba(252, 249, 242, 0.3);
  font-family: -apple-system, sans-serif;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* 1. Raw Documents (Dumping into machine) */
.raw-doc-1 {
  transform-origin: 15px 20px;
  animation: rawDocDump1 3.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.raw-doc-2 {
  transform-origin: 15px 20px;
  animation: rawDocDump2 3.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.raw-doc-bg {
  fill: #27211C;
  stroke: rgba(252, 249, 242, 0.22);
  stroke-width: 1;
}
.raw-line {
  stroke: rgba(252, 249, 242, 0.35);
  stroke-width: 1.2;
  stroke-linecap: round;
}
.raw-line-dashed {
  stroke-dasharray: 2 2;
}
.raw-fold {
  fill: rgba(143, 68, 53, 0.4);
}

/* 2. Perfect Resume Emerging */
.perfect-resume-group {
  transform-origin: 16px 22px;
  animation: perfectResumeEmerge 3.6s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
.resume-sheet {
  fill: #FCF9F2;
  stroke: rgba(252, 249, 242, 0.8);
  stroke-width: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}
.resume-head {
  fill: #1C1A16;
}
.resume-accent-line {
  stroke: var(--rust);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.resume-line {
  stroke: #78716C;
  stroke-width: 1.2;
  stroke-linecap: round;
}
.resume-badge {
  fill: var(--rust);
}
.resume-badge-check {
  stroke: #FCF9F2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sparkle particles on generated resume */
.sp-group {
  animation: sparklePop 3.6s ease-out infinite;
}
.sp-1 {
  fill: #F59E0B;
  transform-origin: 220px 14px;
}
.sp-2 {
  fill: var(--rust-light);
  transform-origin: 260px 22px;
}
.sp-3 {
  fill: #FCF9F2;
  transform-origin: 254px 52px;
}

/* Animation Keyframes */
@keyframes rawDocDump1 {
  0% {
    transform: translate(12px, 16px) rotate(-10deg) scale(0.9);
    opacity: 0;
  }
  8% {
    transform: translate(22px, 14px) rotate(-6deg) scale(1);
    opacity: 1;
  }
  22% {
    transform: translate(52px, 10px) rotate(4deg) scale(1);
    opacity: 1;
  }
  32% {
    transform: translate(78px, 16px) rotate(24deg) scale(0.7);
    opacity: 0.9;
  }
  42% {
    transform: translate(96px, 26px) rotate(38deg) scale(0.3);
    opacity: 0;
  }
  100% {
    transform: translate(96px, 26px) rotate(38deg) scale(0.3);
    opacity: 0;
  }
}

@keyframes rawDocDump2 {
  0%, 10% {
    transform: translate(4px, 28px) rotate(-16deg) scale(0.8);
    opacity: 0;
  }
  16% {
    transform: translate(14px, 24px) rotate(-12deg) scale(0.85);
    opacity: 0.85;
  }
  30% {
    transform: translate(46px, 18px) rotate(-2deg) scale(0.85);
    opacity: 0.85;
  }
  42% {
    transform: translate(74px, 22px) rotate(18deg) scale(0.6);
    opacity: 0.7;
  }
  50% {
    transform: translate(92px, 30px) rotate(32deg) scale(0.25);
    opacity: 0;
  }
  100% {
    transform: translate(92px, 30px) rotate(32deg) scale(0.25);
    opacity: 0;
  }
}

@keyframes machGlowPulse {
  0%, 20% { opacity: 0.25; }
  35%, 65% { opacity: 0.85; }
  85%, 100% { opacity: 0.25; }
}

@keyframes scanBeamSweep {
  0%, 24% {
    transform: translateX(0px);
    opacity: 0;
  }
  28% {
    opacity: 0.9;
  }
  42% {
    transform: translateX(54px);
    opacity: 1;
  }
  58% {
    transform: translateX(18px);
    opacity: 0.9;
  }
  68% {
    transform: translateX(60px);
    opacity: 0;
  }
  100% {
    transform: translateX(0px);
    opacity: 0;
  }
}

@keyframes coreSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes corePulse {
  0%, 25% { transform: scale(0.9); opacity: 0.6; }
  45%, 62% { transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 6px var(--rust-light)); }
  80%, 100% { transform: scale(0.9); opacity: 0.6; }
}

@keyframes ledBlink {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; filter: drop-shadow(0 0 3px currentColor); }
}

@keyframes perfectResumeEmerge {
  0%, 46% {
    transform: translate(174px, 18px) scale(0.45);
    opacity: 0;
  }
  54% {
    transform: translate(188px, 16px) scale(0.75);
    opacity: 0.85;
  }
  68% {
    transform: translate(218px, 10px) rotate(3deg) scale(1);
    opacity: 1;
  }
  74%, 86% {
    transform: translate(220px, 8px) rotate(2deg) scale(1.02);
    opacity: 1;
  }
  94% {
    transform: translate(226px, 6px) rotate(2deg) scale(1);
    opacity: 0;
  }
  100% {
    transform: translate(174px, 18px) scale(0.45);
    opacity: 0;
  }
}

@keyframes sparklePop {
  0%, 65% {
    transform: scale(0);
    opacity: 0;
  }
  72% {
    transform: scale(1.2);
    opacity: 1;
  }
  84% {
    transform: scale(1);
    opacity: 1;
  }
  92%, 100% {
    transform: scale(0.5);
    opacity: 0;
  }
}

/* TOP: Attached Files Preview Cards Row (aligned to left of pill input) */
.sketch-files-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  align-self: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding-left: 6px;
  width: 100%;
}

.sketch-file-card {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: transform var(--transition), box-shadow var(--transition);
}
.sketch-file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* Close/remove badge on top right of preview card */
.sketch-file-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #64748B;
  border: 2px solid var(--bg);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  z-index: 2;
}
.sketch-file-remove-btn:hover {
  background: #EF4444;
  transform: scale(1.1);
}
.sketch-file-remove-btn svg {
  width: 10px;
  height: 10px;
  stroke: #FFFFFF;
  stroke-width: 3;
}

/* PDF Card Icon Badge (Red document with white "PDF" text) */
.sketch-pdf-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 38px;
  background: #EF4444;
  border-radius: 6px;
  position: relative;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}
.sketch-pdf-badge::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: #DC2626;
  border-bottom-left-radius: 4px;
}
.sketch-pdf-text {
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
  margin-top: 2px;
  font-family: var(--sans, system-ui, sans-serif);
}

/* Image Card Icon Badge */
.sketch-img-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #3B82F6;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
  color: #FFFFFF;
}

/* CENTER: Multi-Line Composer Input Card */
.sketch-input-bar {
  width: 100%;
  min-height: 132px;
  border-radius: 24px;
  background: var(--bg-surface);
  border: 1.5px solid var(--rule-medium);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  padding: 18px 18px 14px;
  gap: 12px;
  transition: box-shadow var(--transition);
  box-sizing: border-box;
  cursor: text;
}
.sketch-input-bar:focus-within {
  border-color: var(--rule-medium);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  outline: none;
}
.sketch-composer-screen.drag-over .sketch-input-bar {
  border-color: var(--rust-light);
  box-shadow: 0 0 30px var(--rust-tint);
}

/* Bottom Actions Toolbar Row inside Composer Card */
.sketch-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  flex-shrink: 0;
}

.sketch-input-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Round Leading Add Button & Popover Container */
.sketch-add-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.sketch-add-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--rust);
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
  box-shadow: 0 2px 6px rgba(143, 68, 53, 0.25);
}
.sketch-add-btn:hover {
  background: var(--rust-hover);
  transform: scale(1.05);
}
.sketch-add-btn:active {
  transform: scale(0.96);
}

.sketch-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 1000;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: dropdownPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: top left;
}

[data-theme="light"] .sketch-dropdown-menu {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(15, 23, 42, 0.06);
}

@keyframes dropdownPopIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sketch-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, transform 0.1s ease;
  color: var(--cream);
}

.sketch-dropdown-item:hover,
.sketch-dropdown-item:focus-visible {
  background: rgba(252, 249, 242, 0.08);
  outline: none;
}

[data-theme="light"] .sketch-dropdown-item {
  color: #0F172A;
}

[data-theme="light"] .sketch-dropdown-item:hover,
[data-theme="light"] .sketch-dropdown-item:focus-visible {
  background: #F1F5F9;
}

.dropdown-item-icon {
  display: none;
}

.dropdown-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dropdown-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: inherit;
  line-height: 1.25;
}

.dropdown-item-hint {
  font-size: 0.74rem;
  color: var(--cream-muted);
  line-height: 1.25;
}

[data-theme="light"] .dropdown-item-hint {
  color: #64748B;
}

/* In-card JD Attached Indicator Badge */
.jd-attached-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: var(--rust-tint);
  border: 1px solid var(--rust-border);
  color: var(--rust-light);
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.jd-attached-indicator:hover {
  background: rgba(185, 84, 61, 0.25);
  border-color: var(--rust);
  color: #FFFFFF;
}

[data-theme="light"] .jd-attached-indicator {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #DC2626;
}

/* Top Multi-Line Input Field */
.sketch-input {
  width: 100%;
  min-height: 44px;
  max-height: 144px;
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  resize: none;
  font-family: inherit;
  font-size: 0.96rem;
  color: var(--cream);
  line-height: 1.5;
  padding: 0 2px;
  margin: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sketch-input::placeholder {
  color: var(--cream-muted);
  opacity: 0.85;
}

/* Submit Arrow Button (Bottom-Right Corner) */
.sketch-submit-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(252, 249, 242, 0.08);
  color: var(--cream-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.sketch-submit-btn:hover {
  color: #FFFFFF;
  background: var(--rust);
  transform: scale(1.05);
}
.sketch-submit-btn:active {
  transform: scale(0.96);
}
.sketch-submit-btn.has-input {
  color: #FFFFFF;
  background: var(--rust);
}

/* BOTTOM: Simple Button for Job Description */
.sketch-jd-row {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  width: 100%;
}
.sketch-jd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid transparent;
  padding: 6px 16px;
  color: var(--cream-soft);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius-full);
}
.sketch-jd-btn:hover {
  color: var(--cream);
  background: rgba(252, 249, 242, 0.06);
}
.sketch-jd-btn.has-jd {
  color: var(--rust-light);
  background: var(--rust-tint);
  border-color: var(--rust-border);
}
.sketch-jd-btn.has-jd:hover {
  background: rgba(143, 68, 53, 0.22);
}

/* Popup Dialog Modal for Job Description */
.jd-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 12, 10, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  animation: modalFadeIn 180ms ease forwards;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.jd-dialog {
  width: 580px;
  max-width: 100%;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(143, 68, 53, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 220ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.jd-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--rule);
}
.jd-dialog-head h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--cream);
  margin: 0 0 4px;
}
.jd-dialog-sub {
  font-size: 0.82rem;
  color: var(--cream-muted);
  margin: 0;
}
.jd-dialog-close {
  border: none;
  background: transparent;
  color: var(--cream-muted);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition);
}
.jd-dialog-close:hover {
  color: #EF4444;
}

.jd-dialog-body {
  padding: 20px 24px;
}
.jd-dialog-textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule-medium);
  background: var(--bg-input);
  color: var(--cream);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 14px 16px;
  outline: none !important;
  box-shadow: none !important;
  box-sizing: border-box;
}
.jd-dialog-textarea:focus,
.jd-dialog-textarea:focus-visible {
  border-color: var(--rule-medium) !important;
  box-shadow: none !important;
  outline: none !important;
}

.jd-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(18, 16, 12, 0.55);
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.jd-dialog-hint {
  font-size: 0.78rem;
  color: var(--cream-muted);
}
.jd-dialog-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

/* Light Theme Overrides for Sketch Composer & Dialog */
[data-theme="light"] .sketch-composer-screen {
  background: #F8FAFC;
}
[data-theme="light"] .sketch-hero-title {
  color: #0F172A;
}
[data-theme="light"] .sketch-hero-desc {
  color: #64748B;
}
[data-theme="light"] .mach-chassis {
  fill: #FFFFFF;
  stroke: #CBD5E1;
}
[data-theme="light"] .mach-chassis-inner {
  fill: #F8FAFC;
  stroke: #E2E8F0;
}
[data-theme="light"] .mach-viewport {
  fill: #F1F5F9;
  stroke: #CBD5E1;
}
[data-theme="light"] .mach-fin {
  stroke: #94A3B8;
}
[data-theme="light"] .mach-hopper-chute {
  fill: #F1F5F9;
  stroke: #CBD5E1;
}
[data-theme="light"] .mach-roller {
  fill: #E2E8F0;
  stroke: #CBD5E1;
}
[data-theme="light"] .mach-brand {
  fill: #94A3B8;
}
[data-theme="light"] .raw-doc-bg {
  fill: #FFFFFF;
  stroke: #CBD5E1;
}
[data-theme="light"] .raw-line {
  stroke: #94A3B8;
}
[data-theme="light"] .resume-sheet {
  fill: #FFFFFF;
  stroke: #E2E8F0;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.08));
}
[data-theme="light"] .resume-head {
  fill: #0F172A;
}
[data-theme="light"] .resume-line {
  stroke: #64748B;
}
[data-theme="light"] .sketch-input-bar {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
}
[data-theme="light"] .sketch-input-bar:focus-within {
  border-color: #E2E8F0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  outline: none;
}
[data-theme="light"] .sketch-input {
  color: #0F172A;
}
[data-theme="light"] .sketch-input::placeholder {
  color: #94A3B8;
}
[data-theme="light"] .sketch-submit-btn {
  background: #F1F5F9;
  color: #475569;
}
[data-theme="light"] .sketch-submit-btn:hover,
[data-theme="light"] .sketch-submit-btn.has-input {
  background: var(--rust);
  color: #FFFFFF;
}
[data-theme="light"] .sketch-file-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .sketch-file-remove-btn {
  border-color: #FFFFFF;
  background: #94A3B8;
}
[data-theme="light"] .sketch-jd-btn {
  color: #475569;
}
[data-theme="light"] .sketch-jd-btn:hover {
  color: #0F172A;
  background: #F1F5F9;
}
[data-theme="light"] .sketch-jd-btn.has-jd {
  color: var(--rust);
  background: rgba(143, 68, 53, 0.08);
  border-color: rgba(143, 68, 53, 0.25);
}
[data-theme="light"] .jd-dialog-backdrop {
  background: rgba(15, 23, 42, 0.45);
}
[data-theme="light"] .jd-dialog {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .jd-dialog-head {
  border-color: #E2E8F0;
}
[data-theme="light"] .jd-dialog-head h3 {
  color: #0F172A;
}
[data-theme="light"] .jd-dialog-textarea {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: #0F172A;
}
[data-theme="light"] .jd-dialog-textarea:focus,
[data-theme="light"] .jd-dialog-textarea:focus-visible {
  border-color: #CBD5E1 !important;
  box-shadow: none !important;
  outline: none !important;
}
[data-theme="light"] .jd-dialog-foot {
  background: #F8FAFC;
  border-color: #E2E8F0;
}

/* ========================================================================
   TEMPLATES GALLERY SCREEN (/templates) - Header-Free Top Bar
   ======================================================================== */
.templates-screen {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px clamp(20px, 4vw, 56px) 64px;
  box-sizing: border-box;
  animation: tabFadeIn 220ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.template-top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  min-height: var(--toolbar-item-h);
}

[data-theme="light"] .templates-screen {
  background: transparent;
}
[data-theme="light"] .template-card {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: none !important;
}
[data-theme="light"] .template-card:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
  box-shadow: none !important;
  transform: translateY(-1px);
}
[data-theme="light"] .template-card.selected {
  border: 1px solid #E2E8F0;
  background: #F1F5F9;
  box-shadow: none !important;
}
[data-theme="light"] .template-preview {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
}
[data-theme="light"] .template-preview .pl {
  background: #CBD5E1;
}
[data-theme="light"] .template-preview .pb-title {
  background: var(--tpl-accent, #1E293B);
}
[data-theme="light"] .template-preview .p-side {
  background: color-mix(in srgb, var(--tpl-accent, #94A3B8) 12%, #F8FAFC);
}
[data-theme="light"] .template-preview .p-side .pl {
  background: var(--tpl-accent, #334155);
  opacity: 0.7;
}
[data-theme="light"] .template-card-header h3 {
  color: #111827;
}
[data-theme="light"] .template-card p {
  color: #4B5563;
}
[data-theme="light"] .filter-tab {
  background: #FFFFFF;
  border-color: #E5E7EB;
  color: #4B5563;
}
[data-theme="light"] .filter-tab:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
  color: #111827;
}
[data-theme="light"] .filter-tab.active {
  background: rgba(143, 68, 53, 0.08);
  border-color: rgba(143, 68, 53, 0.35);
  color: var(--rust);
  font-weight: 600;
}

/* Template Gallery Grid */
.field-row { margin-top: 16px; }
.field-label {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--cream);
}
.field-sublabel {
  display: block;
  font-size: 0.78rem;
  color: var(--cream-muted);
  margin-top: 2px;
}

.template-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.template-filter-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-tab {
  height: var(--toolbar-item-h) !important;
  max-height: var(--toolbar-item-h) !important;
  min-height: var(--toolbar-item-h) !important;
  line-height: calc(var(--toolbar-item-h) - 2px);
  font-size: 0.82rem !important;
  font-weight: 500;
  padding: 0 16px !important;
  border-radius: var(--radius-full) !important;
  border: 1px solid var(--rule-medium);
  background: rgba(252, 249, 242, 0.04);
  color: var(--cream-soft);
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box !important;
  white-space: nowrap;
  flex-shrink: 0 !important;
  transition: all var(--transition);
}
.filter-tab:hover {
  background: rgba(252, 249, 242, 0.09);
  color: var(--cream);
  border-color: var(--rule-hover);
}
.filter-tab.active {
  background: var(--rust-tint);
  border-color: var(--rust-border);
  color: var(--rust-light);
  font-weight: 600;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 184px));
  gap: 14px;
  min-height: 480px;
  align-content: start;
  grid-auto-rows: max-content;
}
.template-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: pointer;
  background: var(--bg-surface);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  box-shadow: none !important;
  height: auto;
  align-self: start;
}
.template-card:hover {
  border-color: var(--rule-hover);
  transform: translateY(-1px);
  background: var(--bg-card);
  box-shadow: none !important;
}
.template-card.selected {
  border: 1px solid var(--rule-medium);
  background: rgba(252, 249, 242, 0.08);
  box-shadow: none !important;
}

.template-preview {
  aspect-ratio: 8.5/11;
  background: #14120E;
  border: 1px solid rgba(252, 249, 242, 0.08);
  border-radius: 6px;
  padding: 9%;
  display: flex;
  overflow: hidden;
  box-shadow: none !important;
  transition: background var(--transition), border-color var(--transition);
}
.template-preview .pl {
  display: block;
  height: 5%;
  background: rgba(252, 249, 242, 0.22);
  border-radius: 1px;
  margin-bottom: 6%;
}
.template-preview .pb { margin-bottom: 8%; }
.template-preview .pb-title {
  display: block;
  height: 6%;
  background: var(--tpl-accent, var(--cream-soft));
  border-radius: 1px;
  margin-bottom: 6%;
}
.template-preview .pb .pl { margin-bottom: 5%; }
.p-single, .p-compact { flex-direction: column; width: 100%; }
.p-main { flex: 1; display: flex; flex-direction: column; padding-right: 6%; }
.p-side {
  width: 34%;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--tpl-accent, #8F4435) 16%, #191612);
  padding: 6%;
  border-radius: 4px;
}
.p-side .pl { background: var(--tpl-accent, var(--cream-soft)); opacity: 0.65; }
.layout-sidebar-left { flex-direction: row; gap: 6%; }
.layout-sidebar-right { flex-direction: row-reverse; gap: 6%; }
.p-compact .pb-title { height: 4%; }

.template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 2px;
}
.template-card-header h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.86rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--cream);
}
.tpl-swatch-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.tpl-family-tag {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--rust-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
  display: block;
}
.template-card p {
  font-size: 0.72rem;
  color: var(--cream-soft);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: calc(1.4em * 2);
  max-height: calc(1.4em * 2);
}

/* ========================================================================
   AGENT ACTIVITY OVERLAY (AI Synthesis HUD)
   ======================================================================== */
.generating-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 12, 10, 0.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.agent-card {
  width: 480px;
  max-width: calc(100% - 32px);
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(143, 68, 53, 0.15);
  padding: 36px 32px;
  text-align: center;
  animation: modalIn 260ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.agent-orbital-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
}
.agent-orbital-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}
.agent-orbital-ring.ring-1 {
  border-top-color: var(--rust-light);
  border-bottom-color: var(--rust);
  animation: orbit 1.8s linear infinite;
}
.agent-orbital-ring.ring-2 {
  inset: 6px;
  border-left-color: var(--cream-soft);
  border-right-color: transparent;
  animation: orbitReverse 1.2s linear infinite;
}
.agent-orbital-core {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rust-light);
  animation: pulseCore 1.5s ease-in-out infinite alternate;
}
.agent-orbital-core svg {
  display: block;
  filter: drop-shadow(0 0 8px rgba(200, 109, 88, 0.7));
}
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes orbitReverse { to { transform: rotate(-360deg); } }
@keyframes pulseCore { from { opacity: 0.6; transform: scale(0.9); } to { opacity: 1; transform: scale(1.1); } }

.agent-card h2 {
  font-size: 1.4rem;
  margin-bottom: 4px;
  color: var(--cream);
}
.agent-subtitle {
  color: var(--cream-soft);
  font-size: 0.86rem;
  margin: 0 0 20px;
}

.agent-progress-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(252, 249, 242, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 22px;
}
.agent-progress-bar-fill {
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, var(--rust), var(--rust-light));
  border-radius: 2px;
  animation: progressIndeterminate 2.2s infinite ease-in-out;
}
@keyframes progressIndeterminate {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(120%); }
  100% { transform: translateX(250%); }
}

.agent-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}
.agent-step {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.84rem;
  color: var(--cream-muted);
  transition: all var(--transition);
}
.agent-step .step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(252, 249, 242, 0.05);
  border: 1px solid var(--rule-medium);
  color: var(--cream-soft);
  flex-shrink: 0;
  transition: all var(--transition);
}
.agent-step .step-icon svg {
  display: block;
}
.agent-step.active .step-icon {
  background: rgba(143, 68, 53, 0.2);
  border-color: var(--rust-light);
  color: var(--rust-light);
  box-shadow: 0 0 14px rgba(143, 68, 53, 0.35);
}
.agent-step.completed .step-icon {
  background: rgba(52, 168, 83, 0.12);
  border-color: rgba(52, 168, 83, 0.35);
  color: var(--accent-green);
}
[data-theme="light"] .agent-step .step-icon {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #64748B;
}
[data-theme="light"] .agent-step.active .step-icon {
  background: rgba(143, 68, 53, 0.1);
  border-color: var(--rust);
  color: var(--rust);
}
[data-theme="light"] .agent-step.completed .step-icon {
  background: #F0FDF4;
  border-color: #86EFAC;
  color: #16A34A;
}
.agent-step .step-info {
  display: flex;
  flex-direction: column;
}
.agent-step .step-text {
  font-weight: 500;
  color: inherit;
}
.agent-step .step-sub {
  font-size: 0.74rem;
  color: var(--cream-faint);
  margin-top: 1px;
}
.agent-step.active {
  color: var(--cream);
  font-weight: 600;
  transform: translateX(4px);
}
.agent-step.active .step-text { color: var(--rust-light); }
.agent-step.completed {
  color: var(--accent-green);
}
.agent-step.completed .step-text { color: var(--cream-soft); }

/* ========================================================================
   DOCUMENT STUDIO / EDITOR SCREEN
   ======================================================================== */
.editor-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px 20px 16px;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   Editor App Bar / Top Toolbar
   Enforces 100% exact, uniform control height across all interactive elements
   (back link, title input, save status, save button, download button)
   ========================================================================== */
.editor-toolbar {
  --tb-h: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-shrink: 0;
  width: 100%;
}

.editor-toolbar .title-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: var(--tb-h);
}

.editor-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--rule-medium);
  background: var(--bg-surface);
  color: var(--cream);
  text-decoration: none;
  margin-right: 12px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
}
.editor-back-btn:hover {
  border-color: var(--rust-border);
  color: var(--rust-light);
  background: rgba(252, 249, 242, 0.08);
}
[data-theme="light"] .editor-back-btn {
  background: #FFFFFF;
  border-color: #E2E8F0;
  color: #0F172A;
}
[data-theme="light"] .editor-back-btn:hover {
  background: #F1F5F9;
  color: var(--rust);
}

.editor-toolbar .title-input,
#resumeTitle,
.title-input {
  height: var(--tb-h);
  max-height: var(--tb-h);
  box-sizing: border-box;
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1;
  border: none !important;
  background: transparent !important;
  color: var(--cream);
  padding: 0;
  border-radius: 0;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  cursor: text;
  max-width: 100%;
  caret-color: var(--rust-light);
  transition: opacity var(--transition);
}
[data-theme="light"] .editor-toolbar .title-input,
[data-theme="light"] #resumeTitle,
[data-theme="light"] .title-input {
  background: transparent !important;
  border: none !important;
  color: #111827;
  caret-color: var(--rust);
}
.editor-toolbar .title-input:hover,
#resumeTitle:hover,
.title-input:hover {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  opacity: 0.88;
}
[data-theme="light"] .editor-toolbar .title-input:hover,
[data-theme="light"] #resumeTitle:hover,
[data-theme="light"] .title-input:hover {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}
.editor-toolbar .title-input:focus,
.editor-toolbar .title-input:focus-visible,
#resumeTitle:focus,
#resumeTitle:focus-visible,
.title-input:focus,
.title-input:focus-visible {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  opacity: 1;
}
[data-theme="light"] .editor-toolbar .title-input:focus,
[data-theme="light"] .editor-toolbar .title-input:focus-visible,
[data-theme="light"] #resumeTitle:focus,
[data-theme="light"] #resumeTitle:focus-visible,
[data-theme="light"] .title-input:focus,
[data-theme="light"] .title-input:focus-visible {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  opacity: 1;
}

.editor-toolbar .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  height: var(--tb-h);
}

.editor-toolbar .save-status-wrap {
  height: var(--tb-h);
  max-height: var(--tb-h);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-family: var(--sans);
  font-weight: 500;
  line-height: 1;
  color: var(--cream-muted);
  white-space: nowrap;
  user-select: none;
  background: rgba(252, 249, 242, 0.03);
  border: 1px solid var(--rule);
  transition: all var(--transition);
}
[data-theme="light"] .editor-toolbar .save-status-wrap {
  background: #FFFFFF;
  border-color: #E5E7EB;
  color: #6B7280;
}
.editor-toolbar .save-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  flex-shrink: 0;
  transition: background var(--transition), box-shadow var(--transition);
}
.editor-toolbar .save-status-wrap.is-dirty .save-status-dot {
  background: #E5A440;
  box-shadow: 0 0 6px rgba(229, 164, 64, 0.45);
}
.editor-toolbar .save-status-wrap.is-dirty .save-status-text {
  color: var(--cream-soft);
}
[data-theme="light"] .editor-toolbar .save-status-wrap.is-dirty .save-status-text {
  color: #374151;
}
.editor-toolbar .save-status-wrap.is-saving .save-status-dot {
  background: var(--rust-light);
  animation: pulse-dot 0.8s infinite alternate;
}
@keyframes pulse-dot {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* ========================================================================
   EDITOR TOOLBAR ACTION BUTTONS (Clean Uniform Icon Buttons on Desktop)
   ======================================================================== */
.editor-icon-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  border-radius: var(--radius-full) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  background: rgba(252, 249, 242, 0.05) !important;
  border: 1px solid var(--rule-medium) !important;
  color: var(--cream-soft) !important;
  cursor: pointer;
  transition: all var(--transition);
  box-sizing: border-box !important;
  flex-shrink: 0;
  box-shadow: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  overflow: hidden !important;
}
.editor-icon-btn svg {
  display: block !important;
  flex-shrink: 0 !important;
  pointer-events: none !important;
  margin: auto !important;
}
.editor-icon-btn:hover {
  background: rgba(252, 249, 242, 0.1) !important;
  color: #FFFFFF !important;
  border-color: var(--rule-hover) !important;
}
[data-theme="light"] .editor-icon-btn {
  background: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  color: #374151 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .editor-icon-btn:hover {
  background: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
  color: #111827 !important;
}
.editor-icon-btn:active {
  transform: translateY(0);
}

/* Save Button States */
.editor-toolbar .save-btn.is-dirty {
  border-color: rgba(229, 164, 64, 0.6) !important;
  background: rgba(229, 164, 64, 0.12) !important;
  color: #FBBF24 !important;
}
.editor-toolbar .save-btn.is-dirty:hover {
  border-color: #E5A440 !important;
  background: rgba(229, 164, 64, 0.2) !important;
}
[data-theme="light"] .editor-toolbar .save-btn.is-dirty {
  border-color: #D97706 !important;
  background: #FEF3C7 !important;
  color: #92400E !important;
}
.editor-toolbar .save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Vitae AI Toggle Button Active State */
.editor-toolbar .copilot-toggle-btn.active {
  background: var(--rust-tint) !important;
  border-color: var(--rust-border) !important;
  color: var(--rust-light) !important;
}
.editor-toolbar .copilot-toggle-btn.active:hover {
  background: rgba(143, 68, 53, 0.22) !important;
  border-color: var(--rust-border) !important;
  color: #FFFFFF !important;
}
[data-theme="light"] .editor-toolbar .copilot-toggle-btn.active {
  background: rgba(143, 68, 53, 0.08) !important;
  border-color: rgba(143, 68, 53, 0.25) !important;
  color: var(--rust) !important;
}
[data-theme="light"] .editor-toolbar .copilot-toggle-btn.active:hover {
  background: rgba(143, 68, 53, 0.14) !important;
}

/* Download Dropdown */
.editor-toolbar .download-dropdown-wrap {
  position: relative;
  display: inline-flex;
  height: 36px;
  max-height: 36px;
}
.dropdown-chevron {
  transition: transform var(--transition);
  opacity: 0.85;
}
.download-dropdown-wrap.open .dropdown-chevron {
  transform: rotate(180deg);
}
.download-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 100;
  animation: downloadMenuIn 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes downloadMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.download-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
  text-align: left;
  color: var(--cream-soft);
  font-size: 0.84rem;
  font-weight: 500;
  transition: all var(--transition);
}
.download-menu-item svg {
  color: var(--cream-muted);
  flex-shrink: 0;
  transition: color var(--transition);
}
.download-menu-item:hover {
  background: rgba(252, 249, 242, 0.08);
  color: var(--cream);
}
.download-menu-item:hover svg {
  color: var(--accent-green);
}
.download-menu-item#dlWatermarkedBtn:hover svg {
  color: var(--rust-light);
}

/* Main Workspace Split Layout */
.editor-workspace {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
  position: relative;
  transition: all 220ms ease;
}

.editor-workspace.copilot-collapsed .ai-copilot-panel {
  display: none !important;
}

.editor-workspace.copilot-collapsed .document-stage {
  flex: 1 1 100% !important;
  max-width: 100% !important;
}

/* Document Stage */
.document-stage {
  flex: 1.45;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: #14120E;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: none !important;
  overflow: hidden;
}

.document-stage.mode-code {
  background: #272822;
}

/* Floating Overlay in Top-Right Corner */
.stage-overlay-controls {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stage-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: rgba(26, 23, 19, 0.85);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-full);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}
.stage-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--cream-muted);
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.stage-tab:hover { color: var(--cream); }
.stage-tab.active {
  background: var(--bg-card);
  color: var(--cream);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
[data-theme="light"] .document-stage {
  background: #E5E7EB;
  border-color: var(--rule);
}
[data-theme="light"] .stage-tabs {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--rule-medium);
}
[data-theme="light"] .stage-tab {
  color: var(--cream-muted);
}
[data-theme="light"] .stage-tab:hover {
  color: var(--cream);
}
[data-theme="light"] .stage-tab.active {
  background: #FFFFFF;
  color: var(--cream);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stage-run-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--rust-border);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rust), #9E4A3B);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  flex-shrink: 0;
}
.stage-run-btn:hover {
  background: linear-gradient(135deg, var(--rust-hover), var(--rust));
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}
.stage-run-btn:active { transform: translateY(0); }
.stage-run-btn:disabled,
.stage-run-btn.is-loading {
  cursor: not-allowed;
  transform: none;
  opacity: 0.85;
}

.stage-run-btn .run-icon {
  margin-left: 1.5px;
  display: block;
}
.stage-run-btn .run-spinner-icon {
  display: none;
}

.stage-run-btn.is-loading .run-icon,
.stage-run-btn:disabled .run-icon {
  display: none;
}
.stage-run-btn.is-loading .run-spinner-icon,
.stage-run-btn:disabled .run-spinner-icon {
  display: block;
  animation: run-spin 0.75s linear infinite;
}

@keyframes run-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.stage-canvas-wrap {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.pdf-pane, .editor-pane {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.pdf-pane {
  background: #171512;
  background-image:
    radial-gradient(100% 100% at 50% 50%, #201D17 0%, #15130F 85%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
[data-theme="light"] .pdf-pane {
  background: #E5E7EB;
  background-image: none;
}

.pdf-pages-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px 36px;
  gap: 28px;
  -webkit-overflow-scrolling: touch;
}
.pdf-pages-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.pdf-pages-container::-webkit-scrollbar-thumb {
  background: rgba(252, 249, 242, 0.14);
  border-radius: 4px;
}
.pdf-pages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(252, 249, 242, 0.24);
}

.pdf-page-card {
  position: relative;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: var(--shadow-paper);
  flex-shrink: 0;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.pdf-page-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
}

.pdf-pane.has-pdf .pdf-placeholder { display: none; }
.pdf-placeholder {
  color: var(--cream-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pdf-zoom-dock {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(26, 23, 19, 0.85);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-full);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
}
.dock-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: var(--cream-soft);
  background: rgba(252, 249, 242, 0.06);
  transition: all var(--transition);
}
.dock-btn:hover {
  background: rgba(252, 249, 242, 0.14);
  color: var(--cream);
}
.dock-zoom-label {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--cream-soft);
  padding: 0 4px;
}
[data-theme="light"] .pdf-zoom-dock {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--rule-medium);
}
[data-theme="light"] .dock-btn {
  color: #4B5563;
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .dock-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #111827;
}
[data-theme="light"] .dock-zoom-label {
  color: #4B5563;
}

/* Ace Editor */
.editor-pane {
  background: #272822;
  display: flex;
  flex-direction: column;
}
.ace-editor-container {
  width: 100%;
  height: 100%;
  flex: 1;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
}
.ace_editor { background-color: #272822 !important; }
.ace_gutter {
  background: #1e1f1c !important;
  color: #75715e !important;
  border-right: 1px solid #33332d;
}


/* ========================================================================
   REFINED COMPILER STATUS PILL (Clean, Minimal, Intelligent UX)
   ======================================================================== */
.stage-compile-error-wrap {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  animation: pillIn 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pillIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.compile-error-pill {
  pointer-events: auto;
  max-width: min(560px, calc(100% - 32px));
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 12px;
  background: rgba(26, 23, 19, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(252, 249, 242, 0.12);
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.2);
  color: var(--cream);
  font-family: var(--sans);
  box-sizing: border-box;
}
[data-theme="light"] .compile-error-pill {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #E2E8F0;
  color: #0F172A;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.compile-error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--rust-light);
  flex-shrink: 0;
}
[data-theme="light"] .compile-error-icon {
  color: var(--rust);
}

.compile-error-summary {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}
.compile-error-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cream-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="light"] .compile-error-text {
  color: #334155;
}

.compile-error-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.compile-repair-btn {
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  padding: 0 12px !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  border-radius: var(--radius-full) !important;
  white-space: nowrap;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
}

.compile-error-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--cream-muted);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
  box-sizing: border-box;
}
.compile-error-icon-btn:hover {
  background: rgba(252, 249, 242, 0.08);
  color: var(--cream);
}
[data-theme="light"] .compile-error-icon-btn:hover {
  background: #F1F5F9;
  color: #0F172A;
}
.compile-error-icon-btn.copied {
  color: var(--accent-green) !important;
}

/* ========================================================================
   AI RESUME COPILOT DRAWER (Space Optimized & Collapsible)
   ======================================================================== */
.ai-copilot-panel {
  width: 360px;
  max-width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: none !important;
  overflow: hidden;
  transition: all 220ms ease;
}
[data-theme="light"] .ai-copilot-panel {
  background: #FFFFFF;
  border-color: var(--rule);
  box-shadow: none !important;
}

.copilot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule);
  background: rgba(252, 249, 242, 0.02);
  min-height: 42px;
}
[data-theme="light"] .copilot-header {
  background: #F9FAFB;
}
.copilot-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.copilot-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rust), #9E4A3B);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(143, 68, 53, 0.35);
}
.copilot-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: -0.01em;
}

.copilot-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.copilot-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--cream-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.copilot-icon-btn:hover {
  background: rgba(252, 249, 242, 0.08);
  color: var(--cream);
}
[data-theme="light"] .copilot-icon-btn:hover {
  background: #E5E7EB;
  color: #111827;
}

.copilot-sheet-handle {
  display: none;
}
.copilot-backdrop {
  display: none;
}

.copilot-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 14px;
  scrollbar-width: thin;
  background: var(--bg-canvas);
}
[data-theme="light"] .copilot-thread {
  background: #F4F6F9;
}

/* Clean, Modern Message Thread Design */
.chat-row {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 14px;
  box-sizing: border-box;
}
.chat-row:last-child {
  margin-bottom: 4px;
}

.chat-row.user {
  align-self: flex-end;
  align-items: flex-end;
  max-width: 85%;
  margin-left: auto;
}

.chat-row.user .chat-sender {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
  margin-bottom: 4px;
  padding-right: 2px;
  line-height: 1.2;
}

[data-theme="light"] .chat-row.user .chat-sender {
  color: #64748B;
}

.chat-row.user .chat-text {
  width: fit-content !important;
  max-width: 100% !important;
  background: rgba(255, 255, 255, 0.045) !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  color: var(--cream) !important;
  font-size: 0.83rem;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18) !important;
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="light"] .chat-row.user .chat-text {
  background: #F1F3F5 !important;
  border-color: #E2E8F0 !important;
  color: #1E293B !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

.chat-row.assistant {
  align-self: flex-start;
  align-items: flex-start;
  width: 100%;
}

.chat-row.assistant .chat-sender {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cream-soft);
  margin-bottom: 4px;
  padding-left: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}

[data-theme="light"] .chat-row.assistant .chat-sender {
  color: #0F172A;
}

.chat-row.assistant .chat-text {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  color: var(--cream) !important;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  width: 100%;
}

[data-theme="light"] .chat-row.assistant .chat-text {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #1E293B !important;
}

.chat-row.assistant .chat-text.error {
  color: #F87171 !important;
}

[data-theme="light"] .chat-row.assistant .chat-text.error {
  color: #DC2626 !important;
}

.chat-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--cream-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}

.chat-text.is-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: normal !important;
  white-space: normal !important;
  width: 100%;
}

.chat-avatar,
.chat-time {
  display: none !important;
}

.chat-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}
.chat-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rust-light);
  animation: chat-typing 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.chat-retry-btn {
  align-self: flex-start;
  color: var(--rust-light);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-top: 6px;
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chat-retry-btn:hover {
  text-decoration: underline;
}
[data-theme="light"] .chat-retry-btn {
  color: var(--rust);
}

.chat-bubble-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chat-file-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: rgba(252, 249, 242, 0.06);
  border: 1px solid var(--rule-medium);
  color: var(--cream-soft);
  max-width: 220px;
}
.chat-file-tag svg {
  flex-shrink: 0;
  stroke: var(--rust-light);
}
.chat-file-tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-theme="light"] .chat-file-tag {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .chat-file-tag svg {
  stroke: var(--rust);
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.chip-item {
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--cream-soft);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.chip-item:hover {
  background: var(--bg-card);
  border-color: var(--rust-border);
  color: var(--cream);
  transform: translateY(-1px);
}

/* Empty State Subtle Hints in Chat Center */
.chat-empty-hints {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  margin: auto;
  text-align: center;
  gap: 10px;
  padding: 32px 16px;
  animation: fadeIn 220ms ease;
}
.chat-hint-phrase {
  background: transparent;
  border: none;
  color: var(--cream-muted);
  font-size: 0.84rem;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-align: center;
  max-width: 280px;
  line-height: 1.45;
}
.chat-hint-phrase:hover {
  color: var(--rust-light);
  background: rgba(252, 249, 242, 0.05);
}
[data-theme="light"] .chat-hint-phrase {
  color: #64748B;
}
[data-theme="light"] .chat-hint-phrase:hover {
  color: var(--rust);
  background: #F1F5F9;
}

.copilot-composer {
  flex-shrink: 0;
  border-top: 1px solid var(--rule);
  padding: 8px 12px 10px;
  background: var(--bg-surface);
}
[data-theme="light"] .copilot-composer {
  background: #FFFFFF;
}
.copilot-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: var(--radius-full);
  padding: 2px 8px 2px 10px;
  font-size: 0.7rem;
  color: var(--cream-soft);
  max-width: 220px;
}
.attach-chip button {
  color: var(--cream-muted);
  font-size: 0.85rem;
}
.attach-chip button:hover { color: var(--danger); }

.copilot-error {
  margin: 0 0 6px;
  font-size: 0.72rem;
  color: #fca5a5;
}

.copilot-input-wrap {
  display: flex;
  align-items: center; /* Perfectly aligned horizontally */
  gap: 8px;
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-full);
  background: var(--bg-input);
  padding: 4px 6px 4px 10px;
  min-height: 40px;
  box-sizing: border-box;
  transition: background-color var(--transition);
}
[data-theme="light"] .copilot-input-wrap {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
/* Clean look: no border activation / glow / jumping on focus */
.copilot-input-wrap:focus-within {
  border-color: var(--rule-medium) !important;
  background: var(--bg-input) !important;
  outline: none !important;
  box-shadow: none !important;
}
[data-theme="light"] .copilot-input-wrap:focus-within {
  border-color: #CBD5E1 !important;
  background: #FFFFFF !important;
  outline: none !important;
  box-shadow: none !important;
}

.copilot-attach-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--cream-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  align-self: center;
  margin: 0;
  padding: 0;
}
.copilot-attach-btn:hover {
  background: rgba(252, 249, 242, 0.08);
  color: var(--cream);
}
[data-theme="light"] .copilot-attach-btn:hover {
  background: #F1F5F9;
  color: #111827;
}

.copilot-textarea {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  resize: none;
  outline: none !important;
  box-shadow: none !important;
  font-size: 0.86rem;
  color: var(--cream);
  line-height: 20px;
  max-height: 120px;
  height: 20px;
  min-height: 20px;
  padding: 0 4px;
  margin: 0;
  display: block;
  /* Remove scroll bar */
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  overflow-y: auto;
}
.copilot-textarea::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
[data-theme="light"] .copilot-textarea {
  color: #111827;
}
.copilot-textarea::placeholder {
  color: var(--cream-faint);
}
[data-theme="light"] .copilot-textarea::placeholder {
  color: #94A3B8;
}

.copilot-send-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rust), #9E4A3B);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(143, 68, 53, 0.3);
  transition: all var(--transition);
  align-self: center;
  margin: 0;
  padding: 0;
}
.copilot-send-btn:hover {
  background: linear-gradient(135deg, var(--rust-hover), var(--rust));
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}
.copilot-send-btn:active {
  transform: translateY(0);
}
.copilot-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.copilot-hint {
  margin: 8px 0 0;
  font-size: 0.68rem;
  color: var(--cream-faint);
  text-align: center;
}

/* ========================================================================
   LIBRARY / RESUME REPOSITORY SCREEN
   ======================================================================== */
.library-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.library-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  min-height: var(--toolbar-item-h);
}
.library-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 420px;
  height: var(--toolbar-item-h) !important;
  max-height: var(--toolbar-item-h) !important;
  box-sizing: border-box;
}
.library-search-input {
  width: 100%;
  height: var(--toolbar-item-h) !important;
  max-height: var(--toolbar-item-h) !important;
  min-height: var(--toolbar-item-h) !important;
  line-height: calc(var(--toolbar-item-h) - 2px);
  padding: 0 16px 0 38px !important;
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-full) !important;
  background: var(--bg-surface);
  color: var(--cream);
  font-size: 0.84rem;
  box-sizing: border-box !important;
  transition: all var(--transition);
}
.library-search-input:focus,
.library-search-input:focus-visible {
  outline: none !important;
  border-color: var(--rule-medium) !important;
  box-shadow: none !important;
}
[data-theme="light"] .library-search-input {
  background: #FFFFFF;
  border-color: #E5E7EB;
  color: #111827;
}
[data-theme="light"] .library-search-input:focus,
[data-theme="light"] .library-search-input:focus-visible {
  border-color: #E5E7EB !important;
  box-shadow: none !important;
  outline: none !important;
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cream-muted);
  pointer-events: none;
}
.library-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.library-new-btn,
.library-toolbar-right .btn {
  height: var(--toolbar-item-h) !important;
  max-height: var(--toolbar-item-h) !important;
  min-height: var(--toolbar-item-h) !important;
  line-height: calc(var(--toolbar-item-h) - 2px);
  padding: 0 18px !important;
  font-size: 0.83rem !important;
  font-weight: 600;
  border-radius: var(--radius-full) !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box !important;
  white-space: nowrap;
}
.library-count-tag {
  display: none !important;
}

/* Pagination Controls */
.library-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  padding: 8px 0;
}
.pagination-btn {
  height: var(--toolbar-item-h) !important;
  max-height: var(--toolbar-item-h) !important;
  min-height: var(--toolbar-item-h) !important;
  line-height: calc(var(--toolbar-item-h) - 2px);
  padding: 0 16px !important;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-full) !important;
  border: 1px solid var(--rule-medium);
  background: rgba(252, 249, 242, 0.05);
  color: var(--cream-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-sizing: border-box !important;
  transition: all var(--transition);
}
.pagination-btn:hover:not(:disabled) {
  background: rgba(252, 249, 242, 0.1);
  color: var(--cream);
  border-color: var(--rule-hover);
}
.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pagination-pill {
  height: var(--toolbar-item-h) !important;
  min-width: var(--toolbar-item-h) !important;
  max-height: var(--toolbar-item-h) !important;
  line-height: calc(var(--toolbar-item-h) - 2px);
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-full) !important;
  border: 1px solid var(--rule-medium);
  background: rgba(252, 249, 242, 0.05);
  color: var(--cream-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-sizing: border-box !important;
  transition: all var(--transition);
}
.pagination-pill:hover:not(.active) {
  background: rgba(252, 249, 242, 0.1);
  color: var(--cream);
  border-color: var(--rule-hover);
}
.pagination-pill.active {
  background: linear-gradient(135deg, var(--rust), #9E4A3B);
  border-color: var(--rust-border);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(143, 68, 53, 0.3);
}
.pagination-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--toolbar-item-h);
  min-width: 24px;
  color: var(--cream-muted);
  font-size: 0.9rem;
}
[data-theme="light"] .pagination-btn,
[data-theme="light"] .pagination-pill {
  background: #FFFFFF;
  border-color: #E5E7EB;
  color: #4B5563;
}
[data-theme="light"] .pagination-btn:hover:not(:disabled),
[data-theme="light"] .pagination-pill:hover:not(.active) {
  background: #F9FAFB;
  border-color: #D1D5DB;
  color: #111827;
}
[data-theme="light"] .pagination-pill.active {
  background: #3B82F6;
  border-color: #3B82F6;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.resume-card,
.resume-card-skeleton {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 15px;
  height: 110px;
  min-height: 110px;
  max-height: 110px;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-sizing: border-box;
  box-shadow: none !important;
}
.resume-card {
  text-decoration: none;
  color: var(--cream);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  animation: resumeCardReveal 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes resumeCardReveal {
  from { opacity: 0.72; }
  to { opacity: 1; }
}
[data-theme="light"] .resume-card,
[data-theme="light"] .resume-card-skeleton {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: none !important;
}
.resume-card:hover {
  border-color: var(--rule-hover);
  transform: translateY(-1px);
  background: var(--bg-card);
  box-shadow: none !important;
}
[data-theme="light"] .resume-card:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
  box-shadow: none !important;
}

.resume-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
}
.resume-card-title {
  font-family: var(--sans);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 28px;
  height: 28px;
  margin: 0;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
[data-theme="light"] .resume-card-title {
  color: #0F172A;
}

.resume-card .delete-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--cream-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  margin: 0 -4px 0 0;
}
.resume-card .delete-btn:hover {
  color: #EF4444;
  background: rgba(239, 68, 68, 0.12);
}
@media (hover: hover) {
  .resume-card .delete-btn { opacity: 0; }
  .resume-card:hover .delete-btn, .resume-card .delete-btn:focus-visible { opacity: 1; }
}

.resume-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 29px;
  min-height: 29px;
  max-height: 29px;
  font-size: 0.78rem;
  color: var(--cream-muted);
  border-top: 1px solid var(--rule);
  padding-top: 10px;
  box-sizing: border-box;
}
.resume-template-tag {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  color: var(--rust-light);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="light"] .resume-template-tag {
  color: var(--rust);
}
.resume-date-tag {
  font-size: 0.75rem;
  line-height: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  color: var(--cream-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.resume-card.selected {
  border: 1px solid var(--rule-medium);
  background: rgba(252, 249, 242, 0.08);
  box-shadow: none !important;
}
[data-theme="light"] .resume-card.selected {
  border: 1px solid #E2E8F0;
  background: #F1F5F9;
  box-shadow: none !important;
}

/* ========================================================================
   SHIMMER SKELETON PLACEHOLDERS FOR RESUME CARDS (100% Exact Geometry Match)
   ======================================================================== */
.resume-card-skeleton {
  overflow: hidden;
  pointer-events: none;
}
.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(252, 249, 242, 0.04) 25%,
    rgba(252, 249, 242, 0.1) 37%,
    rgba(252, 249, 242, 0.04) 63%
  );
  background-size: 400% 100%;
  animation: shimmerSweep 1.6s ease-in-out infinite;
}
[data-theme="light"] .skeleton-shimmer {
  background: linear-gradient(
    90deg,
    #F1F5F9 25%,
    #E2E8F0 37%,
    #F1F5F9 63%
  );
  background-size: 400% 100%;
  animation: shimmerSweep 1.6s ease-in-out infinite;
}
@keyframes shimmerSweep {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skeleton-title-bar {
  height: 18px;
  width: 60%;
  border-radius: 4px;
}
.skeleton-delete-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}
@media (hover: hover) {
  .skeleton-delete-circle {
    opacity: 0;
  }
}
.skeleton-tag-bar {
  height: 12px;
  width: 96px;
  border-radius: 4px;
}
.skeleton-date-bar {
  height: 12px;
  width: 62px;
  border-radius: 4px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--cream-soft);
}
.loading-state p { font-size: 0.9rem; margin-top: 12px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 72px 24px;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  color: var(--cream-soft);
}
.empty-icon-box {
  font-size: 2.2rem;
  margin-bottom: 8px;
}
.empty-state h3 { font-size: 1.3rem; margin: 0; color: var(--cream); }
.empty-state p { margin: 0; font-size: 0.88rem; color: var(--cream-muted); max-width: 44ch; }

/* ========================================================================
   SETTINGS SCREEN (Clean, Simple, Professional)
   ======================================================================== */
.settings-screen {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 20px 80px;
  animation: tabFadeIn 200ms ease forwards;
}

.settings-page-header {
  margin-bottom: 28px;
}

.settings-page-title {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.settings-page-subtitle {
  font-size: 0.88rem;
  color: var(--cream-muted);
  margin: 0;
  line-height: 1.5;
}

[data-theme="light"] .settings-page-title {
  color: #0F172A;
}

[data-theme="light"] .settings-page-subtitle {
  color: #64748B;
}

.settings-sections {
  display: flex;
  flex-direction: column;
}

.settings-section {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}

.settings-section:first-child {
  border-top: none;
  padding-top: 0;
}

.settings-section-head h2 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--cream);
  margin: 0 0 4px;
}

.settings-section-head p {
  font-size: 0.82rem;
  color: var(--cream-muted);
  line-height: 1.45;
  margin: 0;
}

[data-theme="light"] .settings-section-head h2 {
  color: #0F172A;
}

[data-theme="light"] .settings-section-head p {
  color: #64748B;
}

.card-title-with-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-subtle {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(252, 249, 242, 0.08);
  color: var(--cream-muted);
  border: 1px solid var(--rule);
}

[data-theme="light"] .badge-subtle {
  background: #F1F5F9;
  border-color: #E2E8F0;
  color: #64748B;
}

/* Theme Segmented Control */
.theme-segmented-control {
  display: inline-flex;
  align-items: center;
  background: rgba(252, 249, 242, 0.05);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 4px;
}

[data-theme="light"] .theme-segmented-control {
  background: #F1F5F9;
  border-color: #E2E8F0;
}

.theme-segment {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}

.theme-segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-segment-btn {
  height: var(--toolbar-item-h, 36px);
  padding: 0 18px;
  border-radius: var(--radius-full);
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--cream-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  box-sizing: border-box;
}

[data-theme="light"] .theme-segment-btn {
  color: #64748B;
}

.theme-segment input:checked + .theme-segment-btn {
  background: var(--rust);
  color: #FFFFFF;
  font-weight: 600;
}

[data-theme="light"] .theme-segment input:checked + .theme-segment-btn {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Settings Profile Row */
.settings-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.profile-info-group {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* Settings Field Groups & Model Control */
.settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.settings-field-group:last-child {
  margin-bottom: 0;
}

.settings-field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: 0.02em;
}

[data-theme="light"] .settings-field-label {
  color: #0F172A;
}

.model-segmented-control {
  width: 100%;
  max-width: 280px;
  display: flex;
}

.model-segmented-control .theme-segment {
  flex: 1;
}

.model-segmented-control .theme-segment-btn {
  width: 100%;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  padding: 0 14px;
  gap: 0;
  font-size: 0.82rem;
}

.settings-key-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-key-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-key-input-wrap .input {
  flex: 1;
  min-width: 240px;
  height: 42px !important;
  min-height: 42px !important;
  line-height: 40px !important;
  padding: 0 16px !important;
  border-radius: var(--radius-full) !important;
  box-sizing: border-box !important;
  font-size: 0.88rem !important;
}

.settings-key-input-wrap .btn {
  height: 42px !important;
  min-height: 42px !important;
  line-height: 40px !important;
  padding: 0 20px !important;
  border-radius: var(--radius-full) !important;
  box-sizing: border-box !important;
  font-size: 0.88rem !important;
}

.settings-link {
  color: var(--rust-light);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color var(--transition);
}
.settings-link:hover {
  color: var(--cream);
}
[data-theme="light"] .settings-link {
  color: var(--rust);
}
[data-theme="light"] .settings-link:hover {
  color: #0F172A;
}

.danger-text {
  color: var(--danger) !important;
}
.danger-text:hover {
  background: var(--danger-tint) !important;
}

.settings-hint {
  font-size: 0.82rem;
  color: var(--cream-muted);
  margin: 4px 0 0;
  line-height: 1.45;
}

/* Ensure empty error/success messages never create blank gaps */
.field-error:empty,
.field-success:empty {
  display: none !important;
  margin: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
}

.danger-section {
  border-top: 1px solid rgba(192, 68, 68, 0.25);
}

.key-status-banner {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.key-status-banner.server-active {
  background: var(--accent-green-tint);
  border-color: rgba(62, 138, 94, 0.35);
  color: #86EFAC;
}
.key-status-banner.user-active {
  background: var(--rust-tint);
  border-color: var(--rust-border);
  color: var(--rust-light);
}
.key-status-banner.none-active {
  background: var(--accent-amber-tint);
  border-color: rgba(201, 139, 50, 0.35);
  color: #FDE047;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23DDD4C4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.profile-avatar-wrap {
  flex-shrink: 0;
}
.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rust), #B85643);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(143, 68, 53, 0.35);
}
.profile-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.profile-email {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--cream);
  word-break: break-all;
}
[data-theme="light"] .profile-email {
  color: #111827;
}
.profile-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #4ADE80;
}
.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 8px #4ADE80;
}
.setting-row.danger-row {
  border-bottom: none;
}

/* ========================================================================
   TOAST NOTIFICATION COMPONENT
   ======================================================================== */
.toast-container {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  color: var(--cream);
  font-size: 0.86rem;
  max-width: 420px;
  animation: toastIn 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.toast-success { border-color: rgba(62, 138, 94, 0.5); }
.toast.toast-error { border-color: rgba(192, 68, 68, 0.5); color: #fca5a5; }
.toast.toast-warning { border-color: rgba(201, 139, 50, 0.5); color: #fde047; }
.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--rust-light);
}
.toast-icon svg { display: block; }
.toast.toast-success .toast-icon { color: var(--accent-green); }
.toast.toast-error .toast-icon { color: #f87171; }
.toast.toast-warning .toast-icon { color: #fbbf24; }
.toast-body { flex: 1; line-height: 1.4; }

/* ========================================================================
   RESPONSIVENESS & SCREEN RESILIENCE
   ======================================================================== */
@media (max-width: 1024px) {
  :root, .app-shell {
    --sb: 0px !important;
  }
  .sidebar { display: none !important; }
  .mobile-header { display: flex; }
  .mobile-tabs { display: flex; }

  .app-shell > main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: calc(var(--mobile-header-h) + var(--safe-top));
    padding-bottom: calc(var(--mobile-tabs-h) + var(--safe-bottom));
  }
  .app-shell:has(.mobile-tabs[hidden]) > main { padding-bottom: 0; }
  .app-shell.is-auth > main { margin-top: 0; padding-bottom: 0; }

  .compose-wrap, .library-screen, .settings-screen {
    padding: 24px 18px 40px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .page-head, .library-head { margin-bottom: 24px; padding-bottom: 18px; }
  .page-head h1, .library-head h1 { font-size: 1.55rem; }

  /* Editor Screen on Tablet / Mobile */
  .editor-screen {
    height: calc(100dvh - var(--mobile-header-h) - var(--safe-top));
    max-height: calc(100dvh - var(--mobile-header-h) - var(--safe-top));
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
  }
  .editor-toolbar {
    padding: 8px 14px;
    border-bottom: 1px solid var(--rule);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-height: 48px;
  }
  .editor-toolbar .toolbar-actions {
    display: none !important; /* Replaced by appbar right corner icon buttons */
  }
  .title-wrap {
    order: 1;
    width: 100%;
    flex: 1 1 100%;
    display: flex;
    align-items: center;
  }
  .title-input {
    font-size: 1.15rem;
    font-weight: 600;
    width: 100% !important;
    max-width: 100%;
    padding: 0;
    border: none !important;
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
  }
  .editor-workspace {
    flex: 1;
    min-height: 0;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .document-stage {
    flex: 1;
    height: 100%;
    min-height: 0;
    border-radius: 0;
    border: none;
    box-shadow: none !important;
    overflow: hidden;
    position: relative;
  }
  .stage-canvas-wrap {
    height: 100%;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 12px 64px;
  }
  .pdf-pages-container {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  .pdf-page-canvas {
    max-width: 100%;
    height: auto !important;
  }
  .stage-overlay-controls {
    top: 10px;
    right: 10px;
    gap: 6px;
    z-index: 40;
  }
  .stage-tab {
    padding: 6px 12px;
    font-size: 0.74rem;
  }
  .stage-run-btn {
    width: 34px;
    height: 34px;
  }
  .stage-overlay-bottom {
    bottom: 12px;
    right: 12px;
    z-index: 40;
  }
  /* Vitae AI as native sliding bottom sheet drawer on mobile */
  .copilot-sheet-handle {
    display: block !important;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.22);
    margin: 10px auto 2px;
    flex-shrink: 0;
  }
  [data-theme="light"] .copilot-sheet-handle {
    background: #CBD5E1;
  }

  .copilot-backdrop {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 998;
    transition: opacity 220ms ease;
  }
  .copilot-backdrop[hidden] {
    display: none !important;
  }

  .ai-copilot-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    max-width: 100% !important;
    height: 76dvh;
    max-height: 82dvh;
    z-index: 999;
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--rule-medium);
    border-bottom: none;
    background: var(--bg-card);
    box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.55);
    transform: translateY(0);
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease;
    display: flex !important;
    flex-direction: column;
  }
  [data-theme="light"] .ai-copilot-panel {
    background: #FFFFFF;
    border-color: #CBD5E1;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
  }
  .editor-workspace.copilot-collapsed .ai-copilot-panel {
    transform: translateY(105%) !important;
    pointer-events: none !important;
    opacity: 0;
  }
  .copilot-header {
    padding: 10px 16px 12px;
    border-bottom: 1px solid var(--rule);
    flex-shrink: 0;
  }
  .copilot-thread {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px;
    background: var(--bg-canvas);
  }
  [data-theme="light"] .copilot-thread {
    background: #F4F6F9;
  }
  .copilot-composer {
    padding: 8px 12px calc(12px + var(--safe-bottom)) !important;
    border-top: 1px solid var(--rule);
    background: var(--bg-surface);
    flex-shrink: 0;
  }
  [data-theme="light"] .copilot-composer {
    background: #FFFFFF;
  }

  /* Settings Screen on Mobile (Clean, Proper Top-to-Bottom Layout) */
  .settings-screen {
    padding: 20px 16px 80px !important;
  }
  .settings-page-header {
    margin-bottom: 20px !important;
  }
  .settings-page-title {
    font-size: 1.5rem !important;
  }
  .settings-section {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    padding: 22px 0 !important;
    border-top: 1px solid var(--rule);
  }
  .settings-section:first-child {
    border-top: none;
    padding-top: 0 !important;
  }
  .settings-section-head {
    width: 100% !important;
  }
  .settings-section-head h2 {
    font-size: 1rem !important;
    margin-bottom: 4px !important;
  }
  .settings-section-head p {
    font-size: 0.84rem !important;
    line-height: 1.45 !important;
  }
  .settings-section-body {
    width: 100% !important;
  }
  .theme-segmented-control {
    width: 100% !important;
    display: flex !important;
  }
  .theme-segment {
    flex: 1 !important;
  }
  .theme-segment-btn {
    width: 100% !important;
    justify-content: center !important;
  }
  .settings-profile-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    width: 100% !important;
    flex-wrap: wrap !important;
  }
  .profile-info-group {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
    flex: 1 !important;
  }
  .settings-profile-row #settingsLogoutBtn {
    width: auto !important;
    flex-shrink: 0 !important;
    height: var(--toolbar-item-h, 36px) !important;
    padding: 0 16px !important;
  }
  .settings-key-form {
    width: 100% !important;
  }
  .settings-key-input-wrap {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 10px !important;
  }
  .settings-key-input-wrap .input {
    min-width: 0 !important;
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
  }
  .settings-key-input-wrap .btn {
    width: 100% !important;
    justify-content: center !important;
    height: 42px !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
  }
  .danger-section #settingsDeleteAccountBtn {
    width: 100% !important;
    justify-content: center !important;
  }
  /* Library Screen on Mobile */
  .library-screen {
    padding: 20px 16px 80px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .library-toolbar-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
  }
  .library-search-wrap {
    flex: 1 !important;
    max-width: none !important;
    min-width: 0 !important;
  }
  .library-toolbar-right {
    flex-shrink: 0 !important;
  }
  .library-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .library-pagination {
    margin-top: 24px !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
  }

  /* Template gallery on mobile (Horizontally scrollable category chips) */
  .template-header-row { flex-direction: column; align-items: flex-start; }
  .template-top-bar {
    width: 100%;
    margin-bottom: 16px;
    overflow: hidden;
  }
  .template-filter-tabs {
    display: flex;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    max-width: 100%;
    width: 100%;
    padding-bottom: 6px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .template-filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab {
    flex-shrink: 0 !important;
  }
  .template-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
    align-content: start;
    grid-auto-rows: max-content;
  }

  /* New Resume Composer Screen on Mobile (Non-scrollable, scaled and centered) */
  .app-shell:has(.sketch-composer-screen) > main {
    overflow: hidden !important;
  }
  .sketch-composer-screen {
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 8px 16px !important;
    justify-content: center !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }
  .sketch-persistent-slot {
    margin-bottom: 8px !important;
  }
  .sketch-hero {
    margin-bottom: 12px !important;
  }
  .sketch-anim-wrap {
    width: clamp(290px, 86vw, 360px) !important;
    height: auto !important;
    aspect-ratio: 280 / 84 !important;
    margin-bottom: 8px !important;
  }
  .sketch-hero-title {
    font-size: 1.25rem !important;
    margin-bottom: 4px !important;
    line-height: 1.2 !important;
  }
  .sketch-hero-desc {
    font-size: 0.78rem !important;
    line-height: 1.35 !important;
    max-width: 320px !important;
  }
  .sketch-composer-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }
  .sketch-input-bar {
    min-height: 116px !important;
    height: auto !important;
    border-radius: 20px !important;
    padding: 14px 14px 12px !important;
    gap: 10px !important;
  }
  .sketch-input {
    font-size: 0.9rem !important;
    min-height: 40px !important;
    padding: 0 2px !important;
  }
  .sketch-add-btn,
  .sketch-submit-btn {
    width: 34px !important;
    height: 34px !important;
  }
  .sketch-jd-row {
    margin-top: 8px !important;
  }
  .sketch-jd-btn {
    font-size: 0.74rem !important;
    padding: 4px 10px !important;
  }
  .sketch-attached-files {
    margin-bottom: 6px !important;
  }
}

/* Auth on Mobile / Small screens */
@media (max-width: 900px) {
  .auth-wrap {
    grid-template-columns: 1fr;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    overflow: hidden !important;
  }
  .auth-story {
    display: none !important;
  }
  .auth-panel {
    height: 100%;
    max-height: 100dvh;
    overflow: hidden !important;
    padding: 16px;
    justify-content: center;
  }
  .auth-mobile-brand {
    display: flex;
  }
  .auth-form-box {
    padding: 24px 20px;
    max-width: 380px;
  }
}

/* Auth on very short viewports */
@media (max-height: 540px) {
  .auth-wrap {
    overflow: hidden !important;
  }
  .auth-story {
    padding: 14px 20px;
  }
  .auth-story-body {
    gap: 8px;
  }
  .auth-story-body h1 {
    font-size: 1.3rem;
  }
  .auth-pitch {
    font-size: 0.8rem;
    line-height: 1.3;
  }
  .auth-perks,
  .auth-eyebrow,
  .auth-story-foot {
    display: none;
  }
  .auth-mobile-brand {
    margin-bottom: 8px;
  }
  .auth-form-box {
    padding: 14px 18px;
  }
  .auth-form-box h2 {
    font-size: 1.15rem;
    margin-bottom: 2px;
  }
  .auth-form-box .lede {
    margin-bottom: 8px;
    font-size: 0.78rem;
  }
  .tabs {
    margin-bottom: 8px;
  }
  .tab {
    padding: 4px;
    font-size: 0.78rem;
  }
  #authForm label {
    margin-bottom: 6px;
  }
  #authForm .input {
    height: 32px;
    font-size: 0.8rem;
  }
  #authSubmit {
    height: 34px;
    font-size: 0.8rem;
  }
  .auth-note {
    margin-top: 6px;
    font-size: 0.68rem;
  }
}

@media (max-width: 480px) {
  .download-btn span { font-size: 0.78rem; }
  .toolbar-actions { gap: 6px; }
  .btn.small { padding: 0 10px; font-size: 0.76rem; }
  .stage-tab { padding: 5px 10px; font-size: 0.74rem; }
  .composer-actions { width: 100%; }
  .composer-actions #generateBtn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell, .app-shell > main, .sidebar, .splash-screen {
    transition: none !important;
    animation: none !important;
  }
}

/* Print Styles */
@media print {
  .sidebar, .mobile-header, .mobile-tabs, .ai-copilot-panel, .stage-overlay-controls, .editor-toolbar, .splash-screen {
    display: none !important;
  }
  .app-shell > main { margin: 0; padding: 0; }
  .pdf-pane { background: #fff !important; }
}

/* ========================================================================
   MODAL DIALOG ENGINE (Beta Alert, Placeholder Safety Check)
   ======================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(10, 9, 8, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalBackdropFadeIn 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 32px rgba(0, 0, 0, 0.4);
  padding: 28px 26px 24px;
  animation: modalCardPopIn 220ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalCardPopIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  margin-bottom: 16px;
}

.modal-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rust-light);
  background: var(--rust-tint);
  border: 1px solid var(--rust-border);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  margin-bottom: 8px;
}

.modal-badge.warning {
  color: #F87171;
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.35);
}

.modal-badge.danger {
  color: #F87171;
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.35);
}

.modal-delete-card {
  max-width: 480px;
}

.modal-danger-box {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 12px 0 10px;
}

[data-theme="light"] .modal-danger-box {
  background: #FEF2F2;
  border-color: #FECACA;
}

.danger-box-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: #FCA5A5;
  margin: 0 0 6px;
}

[data-theme="light"] .danger-box-title {
  color: #DC2626;
}

.danger-data-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.82rem;
  color: var(--cream-soft);
  line-height: 1.55;
}

[data-theme="light"] .danger-data-list {
  color: #475569;
}

.modal-danger-sub {
  font-size: 0.8rem;
  color: var(--cream-muted);
  margin: 0;
}

.modal-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--cream);
}

.modal-body {
  font-size: 0.9rem;
  color: var(--cream-soft);
  line-height: 1.6;
}

.modal-body p {
  margin: 0 0 12px;
}

.modal-highlight-box {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(143, 68, 53, 0.12);
  border: 1px solid var(--rust-border);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--cream-soft);
}

.modal-highlight-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--rust-light);
  margin-top: 2px;
}
.modal-highlight-icon svg {
  display: block;
}

.modal-highlight-box strong {
  display: block;
  color: var(--cream);
  margin-bottom: 2px;
}

.modal-highlight-box p {
  margin: 0;
}

.placeholder-detected-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.placeholder-detected-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 6px 12px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.28);
  border-radius: var(--radius-xs);
  color: #FCA5A5;
}

.placeholder-warning-note {
  font-size: 0.82rem;
  color: var(--cream-muted);
}

.modal-footer {
  margin-top: 22px;
}

.modal-actions-split {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-create-account-card {
  max-width: 400px;
  padding: 24px 24px 20px;
}

.modal-clean-title {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--cream);
  margin: 0 0 10px;
  line-height: 1.3;
}

.modal-clean-desc {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--cream-soft);
  margin: 0 0 22px;
  word-break: break-word;
}

.modal-clean-desc strong {
  color: var(--cream);
  font-weight: 600;
}

.modal-clean-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.modal-clean-actions .btn,
.modal-clean-actions .btn:focus,
.modal-clean-actions .btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

#authForm #authError:not(:empty) {
  display: block;
  text-align: left;
  margin: 0 0 12px;
  padding: 0;
  background: transparent;
  border: none;
  color: #FCA5A5;
  font-size: 0.82rem;
  line-height: 1.45;
}

[data-theme="light"] #authForm #authError:not(:empty) {
  color: #DC2626;
}

/* Mobile Header Brand Logo Theme Toggle */
.brand-logo-dark {
  display: none;
}

[data-theme="light"] .mobile-header .brand-logo-light {
  display: none;
}
[data-theme="light"] .mobile-header .brand-logo-dark {
  display: block;
}

.beta-badge-btn {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--rust-border);
  background: var(--rust-tint);
  color: var(--rust-light);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: all var(--transition);
}

.beta-badge-btn:hover {
  background: var(--rust-tint-strong);
  border-color: var(--rust-glow);
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(184, 86, 67, 0.35);
}

/* Validation Alert Box */
.validation-alert-box {
  margin-top: 14px;
  padding: 14px 18px;
  background: rgba(143, 68, 53, 0.15);
  border: 1px solid var(--rust-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: alertFadeIn 200ms ease;
}

@keyframes alertFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.validation-alert-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.validation-alert-content {
  flex: 1;
}

.validation-alert-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--cream);
  margin-bottom: 3px;
}

.validation-alert-msg {
  font-size: 0.82rem;
  color: var(--cream-soft);
  line-height: 1.45;
  margin: 0;
}

/* Persistent Generation Banner on Home Tab */
.persistent-generation-banner {
  margin-bottom: 20px;
  padding: 14px 20px;
  background: rgba(143, 68, 53, 0.18);
  border: 1px solid var(--rust-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.pgb-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pgb-icon {
  font-size: 1.25rem;
}

.pgb-text strong {
  display: block;
  font-size: 0.88rem;
  color: var(--cream);
}

.pgb-text span {
  font-size: 0.78rem;
  color: var(--cream-muted);
}

.pgb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ========================================================================
   LEGAL DOCUMENTS VIEWER (Terms of Service & Privacy Policy)
   ======================================================================== */
.legal-screen {
  min-height: 100vh;
  width: 100%;
  flex-shrink: 0;
  background: var(--bg);
  color: var(--cream);
  display: flex;
  flex-direction: column;
}

.legal-nav-header {
  width: 100%;
  height: 64px;
  border-bottom: 1px solid var(--rule-medium);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
}

[data-theme="light"] .legal-nav-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.legal-nav-inner {
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legal-nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.legal-nav-brand .brand-logo {
  height: 24px;
  width: auto;
}

.legal-nav-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--rule-strong);
  flex-shrink: 0;
  user-select: none;
}

.legal-nav-doc-label,
.legal-nav-doc-pill {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--cream-soft);
  background: var(--bg-card);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  white-space: nowrap;
}

[data-theme="light"] .legal-nav-doc-label,
[data-theme="light"] .legal-nav-doc-pill {
  background: #F1F5F9;
  border-color: rgba(15, 23, 42, 0.1);
  color: #334155;
}

.legal-nav-switch-link {
  font-weight: 600;
  color: var(--cream-soft);
}

[data-theme="light"] .legal-nav-header .brand-logo-light {
  display: none;
}

[data-theme="light"] .legal-nav-header .brand-logo-dark {
  display: block;
}

.legal-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.legal-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 44px clamp(20px, 4vw, 48px) 96px;
  gap: 52px;
  align-items: flex-start;
  box-sizing: border-box;
}

.legal-toc-sidebar {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.legal-toc-sidebar::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.legal-toc-inner {
  display: flex;
  flex-direction: column;
}

.legal-toc-mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  margin-bottom: 12px;
  background: none;
  border: none;
  cursor: default;
  pointer-events: none;
  text-align: left;
}

.legal-toc-heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cream-faint);
  margin: 0;
  font-weight: 700;
}

.legal-toc-chevron {
  display: none;
  color: var(--cream-muted);
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.legal-toc-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legal-toc-link {
  display: block;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--cream-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: all var(--transition);
  line-height: 1.4;
}

.legal-toc-link:hover {
  color: var(--cream);
  background: var(--bg-card-hover);
}

.legal-toc-link.active {
  color: var(--rust-light);
  border-left-color: var(--rust);
  background: var(--rust-tint);
  font-weight: 700;
}

[data-theme="light"] .legal-toc-link.active {
  color: var(--rust);
}

/* Legal Article Styling */
.legal-article {
  max-width: 800px;
  width: 100%;
  min-width: 0;
}

.legal-article-header {
  margin-bottom: 28px;
}

.legal-tag-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rust-light);
  background: var(--rust-tint);
  border: 1px solid var(--rust-border);
  border-radius: var(--radius-full);
  padding: 3px 12px;
  margin-bottom: 14px;
}

[data-theme="light"] .legal-tag-badge {
  color: var(--rust);
}

.legal-doc-title {
  font-family: var(--sans);
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--cream);
  margin: 0 0 14px;
}

.legal-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--cream-muted);
}

.legal-meta-item strong {
  color: var(--cream-soft);
  font-weight: 700;
}

.legal-meta-sep {
  color: var(--cream-faint);
  user-select: none;
}

.legal-callout-box {
  background: var(--rust-tint);
  border: 1px solid var(--rust-border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin: 24px 0 36px;
}

.legal-callout-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--rust-light);
  margin-bottom: 8px;
}

[data-theme="light"] .legal-callout-title {
  color: var(--rust);
}

.legal-callout-title svg {
  color: var(--rust);
  flex-shrink: 0;
}

.legal-callout-text {
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--cream-soft);
  margin: 0;
}

.legal-section {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 84px;
}

.legal-section-title {
  font-family: var(--sans);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.legal-section-content {
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--cream-soft);
}

.legal-section-content p {
  margin: 0 0 14px;
}

.legal-section-content ul {
  list-style: disc;
  padding-left: 22px;
  margin: 0 0 16px;
}

.legal-section-content li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.legal-section-content strong {
  color: var(--cream);
  font-weight: 700;
}

.legal-subhead {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--cream);
  margin: 20px 0 10px;
}

.legal-article-foot {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--cream-muted);
}

.legal-foot-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 920px) {
  .legal-nav-header {
    height: 56px;
  }
  .legal-nav-inner {
    padding: 0 16px;
    gap: 10px;
  }
  .legal-nav-brand {
    gap: 10px;
  }
  .legal-nav-brand .brand-logo {
    height: 22px;
  }
  .legal-nav-sep,
  .legal-nav-doc-label,
  .legal-nav-doc-pill {
    display: none !important;
  }
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 16px 64px;
  }
  .legal-toc-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
    margin: 0;
    background: var(--bg-surface);
    border: 1px solid var(--rule-medium);
    border-radius: var(--radius-md);
  }
  [data-theme="light"] .legal-toc-sidebar {
    background: #FFFFFF;
    border-color: #E2E8F0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  }
  .legal-toc-mobile-toggle {
    padding: 12px 16px;
    margin-bottom: 0;
    cursor: pointer;
    pointer-events: auto;
  }
  .legal-toc-heading {
    color: var(--cream-soft);
    font-size: 0.76rem;
  }
  .legal-toc-chevron {
    display: block;
  }
  .legal-toc-sidebar.is-open .legal-toc-chevron {
    transform: rotate(180deg);
  }
  .legal-toc-nav {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 4px 10px 12px;
    border-top: 1px solid var(--rule);
  }
  .legal-toc-sidebar.is-open .legal-toc-nav {
    display: flex;
  }
  .legal-toc-link {
    padding: 8px 12px;
    font-size: 0.82rem;
  }
  .legal-article-header {
    margin-bottom: 20px;
  }
  .legal-tag-badge {
    margin-bottom: 10px;
    font-size: 0.68rem;
  }
  .legal-doc-title {
    font-size: clamp(1.6rem, 6vw, 2.05rem);
    margin-bottom: 10px;
  }
  .legal-meta-bar {
    font-size: 0.76rem;
    gap: 6px 8px;
  }
  .legal-callout-box {
    padding: 14px 16px;
    margin: 18px 0 26px;
  }
  .legal-callout-title {
    font-size: 0.88rem;
  }
  .legal-callout-text {
    font-size: 0.83rem;
  }
  .legal-section {
    margin-bottom: 28px;
    padding-bottom: 22px;
    scroll-margin-top: 72px;
  }
  .legal-section-title {
    font-size: 1.12rem;
    margin-bottom: 10px;
    line-height: 1.35;
  }
  .legal-section-content {
    font-size: 0.88rem;
    line-height: 1.65;
  }
  .legal-section-content ul {
    padding-left: 18px;
  }
  .legal-article-foot {
    margin-top: 32px;
    padding-top: 20px;
  }
}

/* ========================================================================
   SYSTEM CONFIGURATIONS AUTH GATE & CONSOLE (/configurations)
   ======================================================================== */
.config-auth-screen {
  min-height: 100vh;
  width: 100%;
  flex-shrink: 0;
  background: var(--bg);
  color: var(--cream);
  display: flex;
  flex-direction: column;
}

.config-auth-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 48px;
}

.config-auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: var(--shadow-lg);
}

.config-auth-icon-ring {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--rust-tint);
  border: 1px solid var(--rust-border);
  color: var(--rust-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

[data-theme="light"] .config-auth-icon-ring {
  color: var(--rust);
}

.config-auth-title {
  font-family: var(--sans);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}

.config-auth-sub {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--cream-muted);
  margin: 0 0 20px;
}

.config-auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.config-auth-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cream-soft);
  text-align: left;
}

.config-auth-submit {
  width: 100%;
  justify-content: center;
  height: 40px;
  margin-top: 4px;
  font-weight: 600;
}

.config-console-shell {
  min-height: 100vh;
  width: 100%;
  flex-shrink: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ========================================================================
   ADMIN / MULTI-PROVIDER ROUTER & AUDIT TELEMETRY (/configurations)
   ======================================================================== */
.admin-view {
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 72px;
  color: var(--cream);
  box-sizing: border-box;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.admin-header-title-block {
  flex: 1;
  min-width: 240px;
}

.admin-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.admin-title {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cream);
  margin: 0;
}

.admin-health-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #22c55e;
}

.admin-health-inline.warning {
  color: #eab308;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.admin-subtitle {
  font-size: 0.86rem;
  color: var(--cream-muted);
  margin: 0;
  line-height: 1.45;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  font-size: 0.86rem;
  font-weight: 600;
  background: none;
  border: none;
  color: var(--cream-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  position: relative;
  top: 1px;
}

.admin-tab:hover {
  color: var(--cream);
}

.admin-tab.active {
  color: var(--cream);
  border-bottom-color: var(--rust);
}

.admin-tab-count {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--cream-faint);
}

/* Stats KPI grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.admin-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
  margin-bottom: 4px;
}

.admin-stat-val {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cream);
  line-height: 1.2;
  margin-bottom: 2px;
}

.admin-stat-sub {
  font-size: 0.74rem;
  color: var(--cream-faint);
}

/* Admin Card */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.admin-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 2px 0;
  color: var(--cream);
}

.admin-card-desc {
  font-size: 0.82rem;
  color: var(--cream-muted);
  margin: 0;
}

/* Provider List & Cards */
.admin-providers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-provider-card {
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 16px;
  transition: border-color 0.15s ease;
}

.admin-provider-card:hover {
  border-color: var(--rule-strong);
}

.admin-provider-card.is-disabled {
  opacity: 0.6;
}

.provider-card-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.provider-precedence-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 36px;
  flex-shrink: 0;
}

.precedence-rank {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--cream-soft);
}

.precedence-btn-group {
  display: flex;
  gap: 2px;
}

.order-btn {
  background: transparent;
  border: 1px solid var(--rule-medium);
  color: var(--cream-muted);
  border-radius: 4px;
  width: 22px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0;
}

.order-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.order-btn:not(:disabled):hover {
  background: var(--bg-hover);
  color: var(--cream);
}

.provider-info-col {
  flex: 1;
  min-width: 0;
}

.provider-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.provider-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--cream);
}

/* Clean chip-free status indicator */
.provider-status-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  text-transform: capitalize;
}

.provider-status-inline .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.provider-status-inline.success {
  color: #22c55e;
}

.provider-status-inline.warning {
  color: #eab308;
}

.provider-status-inline.danger {
  color: #ef4444;
}

.provider-status-inline.disabled {
  color: var(--cream-faint);
}

.provider-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--cream-muted);
  flex-wrap: wrap;
  line-height: 1.4;
}

.provider-model-text {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--cream-soft);
}

.meta-dot {
  color: var(--cream-faint);
}

.text-danger {
  color: #f87171;
}

.provider-endpoint-line {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cream-faint);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-last-error {
  margin-top: 6px;
  font-size: 0.74rem;
  color: #f87171;
  background: rgba(239, 68, 68, 0.06);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid #ef4444;
}

.provider-last-error .err-label {
  font-weight: 700;
}

.provider-actions-col {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.provider-test-result {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--mono);
}

.provider-test-result.testing {
  background: rgba(255, 255, 255, 0.04);
  color: var(--cream-muted);
}

.provider-test-result.success {
  background: rgba(34, 197, 94, 0.08);
  color: #4ade80;
}

.provider-test-result.error {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
}

/* Logs Filter Toolbar */
.admin-filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.admin-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cream-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-select,
.admin-input {
  background: var(--bg-card);
  border: 1px solid var(--rule-medium);
  border-radius: 6px;
  height: 36px;
  padding: 0 10px;
  font-size: 0.82rem;
  color: var(--cream);
  outline: none;
  box-sizing: border-box;
}

.admin-search-group {
  flex: 1;
  min-width: 200px;
}

.admin-filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.admin-auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--cream-muted);
  cursor: pointer;
}

/* Logs Table */
.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.admin-table th {
  padding: 10px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.log-cell-time {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--cream-muted);
  white-space: nowrap;
}

.log-cell-action {
  font-weight: 600;
  color: var(--cream-soft);
  white-space: nowrap;
}

.log-cell-provider strong {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
}

.log-cell-provider .sub-model {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--cream-muted);
}

.log-cell-latency,
.log-cell-chars {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--cream);
  white-space: nowrap;
}

.btn-view-trace {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.74rem;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  padding: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.btn-view-trace:hover {
  color: #fca5a5;
}

.admin-empty-cell {
  text-align: center;
  padding: 32px 14px !important;
  color: var(--cream-muted);
}

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  gap: 10px;
  flex-wrap: wrap;
}

.admin-page-info {
  font-size: 0.78rem;
  color: var(--cream-muted);
}

.admin-page-btns {
  display: flex;
  gap: 8px;
}

/* ========================================================================
   ADMIN MODALS & MOBILE BOTTOM SHEETS (#adminProviderModal, #adminLogDetailModal)
   ======================================================================== */
.admin-sheet-backdrop {
  padding: 16px;
  align-items: center;
  justify-content: center;
}

.admin-modal-card,
.admin-log-modal-card {
  max-width: 520px;
  width: 100%;
  max-height: min(88dvh, 620px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--rule-medium);
  box-shadow: var(--shadow-lg);
}

.admin-log-modal-card {
  max-width: 580px;
}

.sheet-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--rule-strong);
  margin: 10px auto 2px;
  flex-shrink: 0;
}

.admin-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.admin-sheet-header h2 {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 2px 0;
  line-height: 1.3;
}

.admin-sheet-subtitle {
  font-size: 0.78rem;
  color: var(--cream-muted);
  margin: 0;
}

.admin-sheet-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--cream-muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-sheet-close:hover {
  background: var(--bg-hover);
  color: var(--cream);
}

.admin-sheet-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin: 0;
}

.admin-modal-body {
  padding: 16px 22px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.admin-modal-body .input {
  height: 38px;
  padding: 0 11px;
  font-size: 0.84rem;
  border-radius: 7px;
}

.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--cream-soft);
}

.admin-label-opt {
  font-weight: 400;
  color: var(--cream-faint);
}

.admin-field-hint {
  font-size: 0.72rem;
  color: var(--cream-faint);
  margin: -6px 0 0 0;
  line-height: 1.35;
}

.admin-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--cream-soft);
  cursor: pointer;
  padding-top: 2px;
}

.admin-sheet-footer {
  padding: 12px 22px;
  border-top: 1px solid var(--rule);
  background: var(--bg-surface);
  flex-shrink: 0;
  margin: 0;
}

/* Log detail modal content */
.log-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  font-size: 0.82rem;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-row > span:first-child {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cream-faint);
  font-weight: 600;
}

.detail-row > strong {
  color: var(--cream);
  font-weight: 600;
  word-break: break-all;
}

.log-detail-error {
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin-top: 4px;
}

.error-heading {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f87171;
  margin: 0 0 6px 0;
}

.error-pre {
  background: rgba(0, 0, 0, 0.35);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: #fca5a5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
}

/* Light Mode Overrides */
[data-theme="light"] .admin-stat-card,
[data-theme="light"] .admin-card,
[data-theme="light"] .admin-select,
[data-theme="light"] .admin-input,
[data-theme="light"] .admin-modal-card,
[data-theme="light"] .admin-log-modal-card,
[data-theme="light"] .admin-sheet-footer {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .admin-provider-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .admin-table th {
  border-color: #e2e8f0;
}

[data-theme="light"] .admin-table td {
  border-color: #f1f5f9;
}

[data-theme="light"] .admin-table tr:hover td {
  background: #f8fafc;
}

[data-theme="light"] .order-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .error-pre {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ========================================================================
   MOBILE RESPONSIVE & BOTTOM SHEET OVERRIDES (<= 768px)
   ======================================================================== */
@keyframes adminSheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .config-auth-center {
    padding: 20px 16px 36px;
  }

  .config-auth-card {
    padding: 24px 20px;
  }

  .admin-view {
    padding: 18px 14px 64px;
  }

  .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .admin-title {
    font-size: 1.3rem;
  }

  .admin-subtitle {
    font-size: 0.8rem;
  }

  .admin-header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .admin-header-actions .btn {
    justify-content: center;
    width: 100%;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
  }

  .admin-stat-card {
    padding: 12px 14px;
  }

  .admin-stat-val {
    font-size: 1.25rem;
  }

  .admin-stat-sub {
    font-size: 0.7rem;
  }

  .admin-card {
    padding: 14px;
  }

  .provider-card-main {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .provider-precedence-col {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--rule);
  }

  .provider-actions-col {
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid var(--rule);
    justify-content: flex-start;
  }

  .provider-actions-col .btn {
    flex: 1;
    justify-content: center;
    min-width: 64px;
  }

  .admin-filters-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .admin-search-group,
  .admin-filter-actions {
    grid-column: 1 / -1;
  }

  .admin-filter-actions {
    justify-content: space-between;
    margin-left: 0;
  }

  /* Native Mobile Bottom Sheet for Provider & Log Modals */
  .admin-sheet-backdrop {
    padding: 0;
    align-items: flex-end;
    justify-content: stretch;
  }

  .admin-modal-card,
  .admin-log-modal-card {
    max-width: 100%;
    width: 100%;
    max-height: 88dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
    margin: 0;
    animation: adminSheetUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sheet-handle {
    display: block;
  }

  .admin-sheet-header {
    padding: 10px 18px 12px;
  }

  .admin-modal-body {
    padding: 14px 18px;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
  }

  .admin-form-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .admin-sheet-footer {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .log-detail-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ==========================================================================
   ENTERPRISE STUDIO: VISUAL FORM, TEMPLATE SELECTOR, ATS & VERSION TIMELINE
   ========================================================================== */

.editor-template-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--cream);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 28px 5px 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23C5BDB2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  transition: border-color var(--transition);
  max-width: 175px;
  outline: none;
}
.editor-template-select:hover,
.editor-template-select:focus {
  border-color: var(--rule-light);
}

.ats-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(143, 68, 53, 0.15);
  border: 1px solid rgba(143, 68, 53, 0.35);
  color: var(--cream);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
}
.ats-score-pill:hover {
  background: rgba(143, 68, 53, 0.28);
  border-color: var(--terracotta);
}
.ats-score-pill .ats-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
}
.ats-score-pill.low .ats-dot {
  background: #F59E0B;
}

/* ========================================================================
   Visual No-Code Form Pane — Studio Grade Form Editor
   ======================================================================== */
.form-pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 28px 24px;
  background: var(--bg-surface);
  z-index: 10;
}

[data-theme="light"] .form-pane {
  background: #F8FAFC;
}

.form-pane[hidden] {
  display: none;
}

.form-pane-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 60px;
}

/* Form Pane Header */
.form-pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 2px 8px;
}

.form-pane-header-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-pane-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #34D399;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-full, 9999px);
  padding: 2px 8px;
  margin-bottom: 2px;
}

[data-theme="light"] .form-pane-badge {
  color: #059669;
  background: #ECFDF5;
  border-color: #A7F3D0;
}

.form-pane-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.7);
}

.form-pane-title {
  font-family: var(--font-serif);
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.25;
}

[data-theme="light"] .form-pane-title {
  color: #0F172A;
}

.form-pane-subtitle {
  font-size: 0.79rem;
  color: var(--cream-muted);
  margin: 0;
  line-height: 1.4;
}

[data-theme="light"] .form-pane-subtitle {
  color: #64748B;
}

.form-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  padding: 8px 16px !important;
  font-size: 0.81rem !important;
  box-shadow: 0 2px 8px rgba(212, 115, 85, 0.25);
  transition: all 0.18s ease;
}

.form-apply-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(212, 115, 85, 0.35);
}

/* Form Section Containers */
.form-section {
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(255, 255, 255, 0.048);
  border-radius: var(--radius-md, 12px);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .form-section {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.form-section:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .form-section:hover {
  border-color: #CBD5E1;
}

/* Form Section Header */
.form-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.form-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
}

.form-section-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(212, 115, 85, 0.08);
  border: 1px solid rgba(212, 115, 85, 0.18);
  color: var(--terracotta);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="light"] .form-section-icon {
  background: #FDF2EF;
  border-color: #F0C4B8;
  color: #9E4A3B;
}

.form-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.25;
}

[data-theme="light"] .form-section-title {
  color: #0F172A;
}

.form-section-subtitle {
  font-size: 0.75rem;
  color: var(--cream-muted);
  margin: 2px 0 0;
  line-height: 1.35;
}

[data-theme="light"] .form-section-subtitle {
  color: #64748B;
}

/* Form Add Action Button */
.form-add-btn {
  background: rgba(212, 115, 85, 0.08);
  border: 1px solid rgba(212, 115, 85, 0.22);
  color: var(--terracotta);
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.form-add-btn:hover {
  background: rgba(212, 115, 85, 0.16);
  border-color: var(--terracotta);
  transform: translateY(-1px);
}

[data-theme="light"] .form-add-btn {
  background: #FDF2EF;
  border-color: #F0C4B8;
  color: #9E4A3B;
}

[data-theme="light"] .form-add-btn:hover {
  background: #FAE3DC;
  border-color: #9E4A3B;
}

/* Grid & Groups */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .form-section {
    padding: 16px 14px;
  }
  .form-pane {
    padding: 18px 12px;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.70rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--cream-muted);
  text-transform: uppercase;
  letter-spacing: 0.045em;
  line-height: 1.2;
}

[data-theme="light"] .form-label {
  color: #475569;
}

.form-input, .form-textarea {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 6px;
  color: var(--cream);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

[data-theme="light"] .form-input, [data-theme="light"] .form-textarea {
  background: #FFFFFF;
  border-color: #CBD5E1;
  color: #0F172A;
}

.form-input::placeholder, .form-textarea::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

[data-theme="light"] .form-input::placeholder, [data-theme="light"] .form-textarea::placeholder {
  color: #94A3B8;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--terracotta);
  background: rgba(0, 0, 0, 0.38);
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 115, 85, 0.14);
}

[data-theme="light"] .form-input:focus, [data-theme="light"] .form-textarea:focus {
  background: #FFFFFF;
  border-color: #9E4A3B;
  box-shadow: 0 0 0 3px rgba(158, 74, 59, 0.12);
}

.form-textarea {
  line-height: 1.48;
  resize: vertical;
  min-height: 76px;
}

/* List & Cards */
.form-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-item-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 9px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: border-color 0.18s ease, background 0.18s ease;
}

[data-theme="light"] .form-item-card {
  background: #F8FAFC;
  border-color: #E2E8F0;
}

.form-item-card:hover, .form-item-card:focus-within {
  border-color: rgba(255, 255, 255, 0.09);
}

[data-theme="light"] .form-item-card:hover, [data-theme="light"] .form-item-card:focus-within {
  border-color: #CBD5E1;
}

.form-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

[data-theme="light"] .form-item-header {
  border-bottom-color: #EDF2F7;
}

.form-item-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.form-item-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream-soft);
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
}

[data-theme="light"] .form-item-num {
  background: #EDF2F7;
  color: #475569;
}

.form-item-heading {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .form-item-heading {
  color: #0F172A;
}

.form-item-sep {
  color: var(--cream-muted);
  opacity: 0.6;
  font-weight: normal;
  margin: 0 1px;
}

.form-item-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--cream-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.form-item-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.22);
  color: #EF4444;
}

[data-theme="light"] .form-item-delete-btn {
  color: #64748B;
}

[data-theme="light"] .form-item-delete-btn:hover {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #DC2626;
}

/* Empty State Card */
.form-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.008);
  text-align: center;
}

[data-theme="light"] .form-empty-state {
  border-color: #CBD5E1;
  background: #F8FAFC;
}

.form-empty-icon {
  color: var(--cream-muted);
  opacity: 0.6;
}

[data-theme="light"] .form-empty-icon {
  color: #94A3B8;
  opacity: 1;
}

.form-empty-text {
  font-size: 0.78rem;
  color: var(--cream-muted);
}

[data-theme="light"] .form-empty-text {
  color: #64748B;
}

.form-empty-btn {
  background: transparent;
  border: 1px dashed rgba(212, 115, 85, 0.35);
  color: var(--terracotta);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 2px;
}

.form-empty-btn:hover {
  background: rgba(212, 115, 85, 0.1);
  border-color: var(--terracotta);
  transform: translateY(-1px);
}

[data-theme="light"] .form-empty-btn {
  border-color: #F0C4B8;
  color: #9E4A3B;
}

[data-theme="light"] .form-empty-btn:hover {
  background: #FDF2EF;
  border-color: #9E4A3B;
}

/* Modals for Version History & ATS */
.modal-version-card, .modal-ats-card {
  max-width: 580px;
  width: 100%;
}
.version-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}
.version-timeline-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--rule);
  transition: border-color var(--transition);
}
.version-timeline-item:hover {
  border-color: var(--rule-light);
}
.version-meta h4 {
  margin: 0 0 4px 0;
  font-size: 0.88rem;
  color: var(--cream);
  font-weight: 600;
}
.version-meta p {
  margin: 0;
  font-size: 0.76rem;
  color: var(--cream-muted);
  font-family: var(--font-mono);
}

.ats-score-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}
.ats-circle-score {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cream);
  border: 3px solid var(--terracotta);
  background: rgba(143, 68, 53, 0.15);
}
.ats-score-meta h4 {
  margin: 0 0 4px 0;
  font-size: 0.95rem;
  color: var(--cream);
}
.ats-score-meta p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--cream-muted);
}
.ats-keywords-block h5 {
  margin: 0 0 8px 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  color: var(--cream-muted);
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}
.keyword-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.keyword-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-family: var(--font-mono);
}
.keyword-chip.matched {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34D399;
}
.keyword-chip.missing {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #FBBF24;
}
.ats-recs-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.82rem;
  color: var(--cream-muted);
  line-height: 1.5;
}

/* Copilot Quick Slash Action Pills */
.copilot-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.copilot-quick-actions::-webkit-scrollbar {
  display: none;
}
.copilot-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-full);
  color: var(--cream-muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.copilot-action-chip:hover {
  background: rgba(143, 68, 53, 0.15);
  border-color: var(--terracotta);
  color: var(--cream);
}

/* =======================================================================
   Conversational Assistant Interactive Elements & Static Field Cards
   ======================================================================= */
.chat-card-widget {
  background: var(--bg-card, #2B2620);
  border: 1px solid var(--rule-medium, rgba(252, 249, 242, 0.14));
  border-radius: var(--radius-md, 10px);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  width: 100%;
  box-sizing: border-box;
  margin-top: 0 !important;
  white-space: normal !important;
}

[data-theme="light"] .chat-card-widget {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.chat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--rule, rgba(252, 249, 242, 0.08));
}

[data-theme="light"] .chat-card-header {
  background: #F8FAFC;
  border-bottom-color: #F1F5F9;
}

.chat-card-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: -0.01em;
}

[data-theme="light"] .chat-card-title {
  color: #0F172A;
}

.chat-card-badge {
  font-size: 0.70rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(212, 115, 85, 0.12);
  color: var(--terracotta);
  border: 1px solid rgba(212, 115, 85, 0.24);
  white-space: nowrap;
}

.chat-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm, 6px);
  transition: background var(--transition), border-color var(--transition);
}

.chat-field-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.chat-field-row.active {
  background: rgba(212, 115, 85, 0.08);
  border-color: rgba(212, 115, 85, 0.25);
}

[data-theme="light"] .chat-field-row {
  background: #F8FAFC;
  border-color: #F1F5F9;
}

[data-theme="light"] .chat-field-row:hover {
  background: #F1F5F9;
  border-color: #E2E8F0;
}

[data-theme="light"] .chat-field-row.active {
  background: #FDF4F2;
  border-color: #E6B5A7;
}

.chat-field-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-field-primary {
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--cream);
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="light"] .chat-field-primary {
  color: #0F172A;
}

.chat-field-secondary {
  font-size: 0.73rem;
  color: var(--cream-muted);
  line-height: 1.35;
}

[data-theme="light"] .chat-field-secondary {
  color: #64748B;
}

.chat-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-xs, 4px);
  border: 1px solid rgba(212, 115, 85, 0.35);
  background: rgba(212, 115, 85, 0.12);
  color: var(--terracotta);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-card-btn:hover {
  background: var(--terracotta);
  color: #FFFFFF !important;
  border-color: var(--terracotta);
}

[data-theme="light"] .chat-card-btn {
  background: rgba(143, 68, 53, 0.08);
  border-color: rgba(143, 68, 53, 0.28);
  color: #8F4435;
}

[data-theme="light"] .chat-card-btn:hover {
  background: #8F4435;
  color: #FFFFFF !important;
  border-color: #8F4435;
}

.chat-card-btn:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.chat-card-status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream-muted);
  white-space: nowrap;
}

.chat-card-status-pill.active {
  background: rgba(74, 222, 128, 0.12);
  color: #4ADE80;
  border: 1px solid rgba(74, 222, 128, 0.25);
}

[data-theme="light"] .chat-card-status-pill.active {
  background: #ECFDF5;
  color: #16A34A;
  border-color: #A7F3D0;
}

/* ATS Meter Bar */
.ats-meter-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  margin: 2px 0 8px;
  display: flex;
}

[data-theme="light"] .ats-meter-bar {
  background: #E2E8F0;
}

.ats-meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.ats-meter-fill.score-high {
  background: linear-gradient(90deg, #10B981, #059669);
}

.ats-meter-fill.score-medium {
  background: linear-gradient(90deg, #F59E0B, #D97706);
}

.ats-meter-fill.score-low {
  background: linear-gradient(90deg, #EF4444, #DC2626);
}

.ats-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 4px 0 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm, 6px);
  padding: 6px 8px;
  text-align: center;
}

[data-theme="light"] .ats-breakdown-grid {
  background: #F8FAFC;
  border-color: #E2E8F0;
}

.ats-breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ats-breakdown-val {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cream);
  font-family: var(--font-mono, monospace);
}

[data-theme="light"] .ats-breakdown-val {
  color: #0F172A;
}

.ats-breakdown-lbl {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--cream-muted);
}

[data-theme="light"] .ats-breakdown-lbl {
  color: #64748B;
}

.ats-static-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ats-section-label {
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
}

[data-theme="light"] .ats-section-label {
  color: #64748B;
}

.ats-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.ats-chip {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.ats-chip.matched {
  background: rgba(16, 185, 129, 0.12);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .ats-chip.matched {
  background: #ECFDF5;
  color: #059669;
  border-color: #A7F3D0;
}

.ats-chip.missing {
  background: rgba(245, 158, 11, 0.12);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

[data-theme="light"] .ats-chip.missing {
  background: #FFFBEB;
  color: #D97706;
  border-color: #FDE68A;
}

.ats-tip-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--rule-medium);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.75rem;
  color: var(--cream-soft);
  line-height: 1.4;
}

[data-theme="light"] .ats-tip-box {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #334155;
}

.chat-card-footer {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.015);
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

[data-theme="light"] .chat-card-footer {
  background: #F8FAFC;
  border-top-color: #F1F5F9;
}

.chat-card-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-xs, 4px);
  border: 1px solid rgba(212, 115, 85, 0.4);
  background: rgba(212, 115, 85, 0.15);
  color: var(--terracotta);
  cursor: pointer;
  transition: all var(--transition);
}

.chat-card-primary-action:hover {
  background: var(--terracotta);
  color: #FFFFFF !important;
  border-color: var(--terracotta);
}

[data-theme="light"] .chat-card-primary-action {
  background: rgba(143, 68, 53, 0.1);
  border-color: rgba(143, 68, 53, 0.35);
  color: #8F4435;
}

[data-theme="light"] .chat-card-primary-action:hover {
  background: #8F4435;
  color: #FFFFFF !important;
  border-color: #8F4435;
}

.ats-chat-jd-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--cream);
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
  resize: vertical;
}

.ats-chat-jd-input:focus {
  outline: none;
  border-color: var(--terracotta);
}

[data-theme="light"] .ats-chat-jd-input {
  background: #FFFFFF;
  border-color: #E2E8F0;
  color: #0F172A;
}

/* ==========================================================================
   Public Resume Sharing & Vanity URL Modal Styling
   ========================================================================== */
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.share-btn.is-active,
.share-icon-btn.is-active {
  color: var(--emerald, #10B981) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

.modal-share-clean-card {
  max-width: 440px;
  width: 92vw;
  padding: 22px 24px 20px;
  border-radius: 18px;
  border: 1px solid var(--rule);
  background: var(--bg-card);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.4), 0 0 1px 1px var(--rule);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

[data-theme="light"] .modal-share-clean-card {
  background: #FFFFFF;
  border-color: #E5E7EB;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.share-clean-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.share-clean-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--cream);
  margin: 0;
  line-height: 1.25;
}

[data-theme="light"] .share-clean-title {
  color: #111827;
}

.share-clean-subtitle {
  font-size: 0.8rem;
  color: var(--cream-muted);
  margin: 4px 0 0;
  line-height: 1.35;
}

[data-theme="light"] .share-clean-subtitle {
  color: #6B7280;
}

.share-close-x-btn {
  background: transparent;
  border: none;
  color: var(--cream-muted);
  padding: 6px;
  margin: -4px -6px 0 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background-color 0.15s;
}

.share-close-x-btn:hover {
  color: var(--cream);
  background-color: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .share-close-x-btn {
  color: #9CA3AF;
}

[data-theme="light"] .share-close-x-btn:hover {
  color: #111827;
  background-color: #F3F4F6;
}

.share-clean-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-clean-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--rule);
}

[data-theme="light"] .share-clean-toggle-row {
  border-bottom-color: #F3F4F6;
}

.share-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-clean-toggle-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cream);
}

[data-theme="light"] .share-clean-toggle-label {
  color: #111827;
}

.share-clean-toggle-hint {
  font-size: 0.76rem;
  color: var(--cream-muted);
}

[data-theme="light"] .share-clean-toggle-hint {
  color: #6B7280;
}

/* Apple-style minimalist switch toggle */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 22px;
  border: 1px solid var(--rule);
}

[data-theme="light"] .switch-slider {
  background-color: #E5E7EB;
  border-color: #D1D5DB;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: #FFFFFF;
  transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch-toggle input:checked + .switch-slider {
  background-color: #10B981;
  border-color: #10B981;
}

.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(18px);
}

.share-clean-link-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-clean-input-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 4px 6px 4px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.share-clean-input-box:focus-within {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 2px rgba(158, 74, 59, 0.2);
}

[data-theme="light"] .share-clean-input-box {
  background: #F9FAFB;
  border-color: #E5E7EB;
}

[data-theme="light"] .share-clean-input-box:focus-within {
  background: #FFFFFF;
  border-color: var(--terracotta);
}

.share-clean-url-field {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem !important;
  color: var(--cream) !important;
  padding: 6px 0 !important;
  outline: none !important;
}

[data-theme="light"] .share-clean-url-field {
  color: #1F2937 !important;
}

.share-clean-copy-btn {
  border-radius: 9999px !important;
  height: 30px !important;
  padding: 0 12px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  gap: 5px !important;
  flex-shrink: 0;
}

.share-clean-icon-link {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: var(--cream-muted);
  border: 1px solid transparent;
  transition: color 0.15s, background-color 0.15s;
  flex-shrink: 0;
  text-decoration: none;
}

.share-clean-icon-link:hover {
  color: var(--cream);
  background-color: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .share-clean-icon-link {
  color: #6B7280;
}

[data-theme="light"] .share-clean-icon-link:hover {
  color: #111827;
  background-color: #E5E7EB;
}

.share-clean-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 0;
}

.share-edit-slug-btn {
  background: transparent;
  border: none;
  color: var(--terracotta);
  font-size: 0.76rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 2px 0;
  transition: opacity 0.15s;
}

.share-edit-slug-btn:hover {
  opacity: 0.85;
  text-decoration: underline;
}

.share-edit-slug-btn svg {
  transition: transform 0.2s ease;
}

.share-edit-slug-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.share-clean-views {
  font-size: 0.74rem;
  color: var(--cream-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

[data-theme="light"] .share-clean-views {
  color: #9CA3AF;
}

.share-clean-custom-drawer {
  margin-top: 4px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

[data-theme="light"] .share-clean-custom-drawer {
  background: #F9FAFB;
  border-color: #E5E7EB;
}

.share-custom-inputs-row {
  display: flex;
  gap: 10px;
}

.share-slug-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.share-slug-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cream-muted);
}

[data-theme="light"] .share-slug-label {
  color: #6B7280;
}

.prefix-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  overflow: hidden;
}

[data-theme="light"] .prefix-input-wrap {
  background: #FFFFFF;
  border-color: #CBD5E1;
}

.prefix-addon {
  padding: 6px 8px;
  font-size: 0.8rem;
  color: var(--cream-muted);
  font-weight: 600;
  user-select: none;
  background: rgba(255, 255, 255, 0.04);
  border-right: 1px solid var(--rule);
}

[data-theme="light"] .prefix-addon {
  background: #F1F5F9;
  border-color: #E2E8F0;
  color: #64748B;
}

.prefix-input-wrap input {
  border: none !important;
  background: transparent !important;
  padding: 6px 8px !important;
  font-size: 0.8rem !important;
  flex: 1;
  min-width: 0;
  outline: none !important;
  color: var(--cream) !important;
}

[data-theme="light"] .prefix-input-wrap input {
  color: #0F172A !important;
}

.share-clean-footer {
  margin-top: 4px;
}

.share-clean-footer .btn.primary {
  border-radius: 9999px !important;
  height: 38px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
}





