/* ==========================================================================
   DrawingViewer CAD Web — Core Stylesheet
   Mobile-First • Zero CLS • Accessible • WebAssembly High-Performance Theme
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0B0F17;
  --bg-secondary: #111827;
  --bg-tertiary: #1E293B;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-surface: #172033;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(56, 189, 248, 0.2);
  --border-highlight: #38BDF8;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  
  --accent-cyan: #00E5FF;
  --accent-blue: #0284C7;
  --accent-indigo: #4F46E5;
  --accent-amber: #F59E0B;
  --accent-emerald: #10B981;
  --accent-rose: #F43F5E;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout & Spacing */
  --container-max: 1200px;
  --header-height: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 229, 255, 0.25);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(2, 132, 199, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 100% 50%, rgba(0, 229, 255, 0.05) 0%, transparent 50%);
  background-repeat: no-repeat;
}

/* Accessibility Focus States */
:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Skip link for screen readers */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--accent-cyan);
  color: var(--bg-primary);
  padding: 10px 16px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  z-index: 9999;
  transition: top var(--transition-fast);
}
.skip-to-content:focus {
  top: 16px;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

p {
  margin-bottom: 1.2rem;
  color: var(--text-muted);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2rem, 5vw + 1rem, 3.5rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.5rem, 3vw + 0.8rem, 2.25rem);
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(1.2rem, 2vw + 0.5rem, 1.5rem);
}

ul, ol {
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
  color: var(--text-muted);
}
li {
  margin-bottom: 0.5rem;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand-logo:hover {
  text-decoration: none;
}
.brand-logo img, .brand-logo svg {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.brand-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 4px;
}

/* Desktop Navigation */
.nav-menu {
  display: none;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color var(--transition-fast);
  padding: 6px 0;
  position: relative;
}
.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  text-decoration: none;
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-cyan);
  border-radius: 2px;
}

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

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  cursor: pointer;
  padding: 8px;
}
.mobile-nav-toggle:hover {
  background: var(--bg-tertiary);
}

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  z-index: 99;
  border-top: 1px solid var(--border-subtle);
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}
.mobile-drawer.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.mobile-drawer .nav-link {
  font-size: 1.2rem;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: block;
}

/* ==========================================================================
   Buttons & Badges
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #00E5FF 0%, #0284C7 100%);
  color: #04111D;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.35);
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.5);
  color: #04111D;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: #2D3D54;
  color: #FFFFFF;
}

.btn-outline {
  background: transparent;
  color: var(--accent-cyan);
  border-color: rgba(0, 229, 255, 0.4);
}
.btn-outline:hover {
  background: rgba(0, 229, 255, 0.1);
  border-color: var(--accent-cyan);
  color: #fff;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: var(--accent-cyan);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  padding: 3.5rem 0 2rem;
  text-align: center;
}
.hero-content {
  max-width: 840px;
  margin: 0 auto 2.5rem;
}
.hero-title {
  background: linear-gradient(180deg, #FFFFFF 0%, #94A3B8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.2rem;
}
.hero-desc {
  font-size: clamp(1.05rem, 1.2vw + 0.8rem, 1.3rem);
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 2rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* ==========================================================================
   CAD Viewer Sandbox & Workspace
   ========================================================================== */
.viewer-workspace {
  background: #06090E;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-glow), var(--shadow-md);
  margin-bottom: 3.5rem;
  position: relative;
}

.viewer-header {
  background: #0E1524;
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
  flex-shrink: 1;
}
.site-header .viewer-toolbar,
#studioHeaderToolbar {
  overflow: visible;
}
.viewer-toolbar::-webkit-scrollbar {
  display: none;
}

.tool-btn {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tool-btn:hover {
  background: #253347;
  color: var(--text-main);
  border-color: var(--accent-cyan);
}
.tool-btn.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.canvas-container {
  position: relative;
  width: 100%;
  height: 520px;
  background-color: #070B11;
  cursor: grab;
  user-select: none;
  overflow: hidden;
}
.canvas-container:active {
  cursor: grabbing;
}
.canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Overlay readout bar */
.viewer-statusbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(14, 21, 36, 0.85);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-subtle);
  padding: 6px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  z-index: 10;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-pill strong {
  color: var(--text-main);
}

/* File Dropzone overlay */
.dropzone-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 23, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 20;
  padding: 20px;
  text-align: center;
  transition: opacity var(--transition-normal);
}
.dropzone-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.dropzone-box {
  border: 2px dashed rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  padding: 30px;
  max-width: 480px;
  width: 100%;
  background: rgba(17, 24, 39, 0.6);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.05);
}

/* ==========================================================================
   Trust & Metrics Ribbon
   ========================================================================== */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.stat-card {
  text-align: center;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Features Section
   ========================================================================== */
.section {
  padding: 4rem 0;
}
.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
}
.section-subtitle {
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.75rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: transform var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-medium);
}
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(2, 132, 199, 0.15);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.feature-icon svg {
  width: 26px;
  height: 26px;
}

/* ==========================================================================
   AdSense Reserved Slots (Zero CLS Guarantee)
   ========================================================================== */
.ad-slot-container {
  width: 100%;
  margin: 2.5rem auto;
  text-align: center;
  background: rgba(14, 21, 36, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.ad-slot-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 4px 8px;
  margin-bottom: 4px;
}

/* Fixed reserved heights to completely prevent CLS */
.ad-slot-leaderboard {
  min-height: 100px;
  max-width: 970px;
}
.ad-slot-rectangle {
  min-height: 280px;
  max-width: 336px;
}
.ad-slot-horizontal {
  min-height: 90px;
  max-width: 728px;
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.faq-question {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 1.25rem;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.faq-question:hover {
  background: rgba(255, 255, 255, 0.02);
}
.faq-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-fast);
  color: var(--accent-cyan);
}
.faq-item.is-open .faq-icon {
  transform: rotate(180deg);
}
.faq-answer {
  padding: 0 1.25rem 1.25rem;
  display: none;
  color: var(--text-muted);
}
.faq-item.is-open .faq-answer {
  display: block;
}

/* ==========================================================================
   Content Article Pages (About, Privacy, Terms, Disclaimer)
   ========================================================================== */
.content-page {
  padding: 3rem 0 5rem;
}
.content-wrapper {
  max-width: 840px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 3.5rem);
}
.content-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}
.content-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.content-body h2 {
  margin-top: 2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}
.content-body h3 {
  margin-top: 1.5rem;
}
.content-body strong {
  color: var(--text-main);
}
.content-callout {
  background: rgba(2, 132, 199, 0.1);
  border-left: 4px solid var(--accent-cyan);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.5rem 0;
}

/* ==========================================================================
   Forms (Contact Page)
   ========================================================================== */
.form-group {
  margin-bottom: 1.5rem;
}
.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent-cyan);
  outline: none;
}
.form-textarea {
  min-height: 140px;
  resize: vertical;
}

/* ==========================================================================
   Cookie Consent Banner (GDPR)
   ========================================================================== */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  max-width: 500px;
  background: #0E1524;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transform: translateY(120%);
  opacity: 0;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}
.cookie-banner.is-visible {
  transform: translateY(0);
  opacity: 1;
}
.cookie-content {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.cookie-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: auto;
  background: #070B11;
  border-top: 1px solid var(--border-subtle);
  padding: 3.5rem 0 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}
.footer-col h4 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  margin-bottom: 1rem;
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links li {
  margin-bottom: 0.6rem;
}
.footer-links a {
  color: var(--text-muted);
  font-size: 0.88rem;
}
.footer-links a:hover {
  color: var(--accent-cyan);
}
.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  gap: 1rem;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (min-width: 768px) {
  .nav-menu {
    display: flex;
  }
  .mobile-nav-toggle {
    display: none;
  }
  .canvas-container {
    height: 600px;
  }
}


/* ==========================================================================
   CAD Studio Professional UI — Sidebar Tabs, Command Line, Tool Ribbon, Modals
   ========================================================================== */

/* Enhanced Studio Sidebar */
.studio-sidebar {
  width: 320px !important;
  background: #0B111E !important;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transition: transform var(--transition-normal);
  user-select: none;
}

.studio-tabs {
  display: flex;
  background: #070B12;
  border-bottom: 1px solid var(--border-subtle);
}

.studio-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 10px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.studio-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.studio-tab-btn.is-active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.06);
}

.tab-badge {
  background: rgba(0, 229, 255, 0.18);
  color: var(--accent-cyan);
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.studio-tab-pane {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
}

.studio-tab-pane.is-active {
  display: flex;
}

/* Layer Search & Controls */
.layer-search-wrap {
  position: relative;
  margin-bottom: 8px;
}

.layer-search {
  width: 100%;
  background: #111A2C;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 6px 10px 6px 28px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.layer-search:focus {
  border-color: var(--accent-cyan);
}

.layer-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.layer-actions-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.btn-layer-action {
  flex: 1;
  background: #162035;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.btn-layer-action:hover {
  background: #1E2D4A;
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.layer-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(56, 189, 248, 0.2);
}

.layer-item.is-current {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
}

.layer-color-picker-input {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  cursor: pointer;
  background: transparent;
  margin-right: 8px;
}
.layer-color-picker-input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.layer-color-picker-input::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.btn-icon-toggle {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color var(--transition-fast);
}

.btn-icon-toggle:hover {
  color: var(--text-main);
}

.btn-icon-toggle.active {
  color: var(--accent-cyan);
}

/* Properties Inspector */
.prop-card {
  background: #111A2C;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
}

.prop-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.prop-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--accent-cyan);
}

.prop-badge {
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.prop-label {
  color: var(--text-muted);
  flex: 1;
}

.prop-val {
  font-family: var(--font-mono);
  color: var(--text-main);
  text-align: right;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prop-input, .prop-select {
  background: #0B111E;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-main);
  padding: 3px 6px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  width: 140px;
  outline: none;
}
.prop-input:focus, .prop-select:focus {
  border-color: var(--accent-cyan);
}

/* Measurements Tab (Matches Android App MeasurementsSheet & CadCanvas) */
.measure-card {
  background: #111A2C;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}
.measure-card:hover {
  border-color: var(--accent-cyan);
  background: #152238;
}
.measure-card.is-hidden {
  opacity: 0.45;
  background: rgba(17, 26, 44, 0.4);
  border-style: dashed;
}
.measure-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.measure-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  border: 1px solid currentColor;
  flex-shrink: 0;
}
.measure-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.measure-card-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.measure-act-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.measure-act-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}
.measure-act-btn.btn-delete:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #EF4444;
}
.measure-val {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  margin-bottom: 2px;
}
.measure-details {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  word-break: break-all;
  margin-bottom: 4px;
}
.measure-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  color: var(--text-dim);
}
.measure-time {
  font-size: 0.68rem;
  color: var(--text-dim);
}
.measure-hidden-tag {
  background: #334155;
  color: #94A3B8;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Total Area Summary Card */
.measure-total-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0F291E;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.measure-total-icon {
  font-size: 1.4rem;
}
.measure-total-content {
  flex: 1;
}
.measure-total-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #34D399;
}
.measure-total-val {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #A7F3D0;
}
.measure-total-sub {
  font-size: 0.68rem;
  color: #6EE7B7;
}

/* Floating Active Measurement Toolbar (Top-Center of Canvas) */
.measure-floating-bar {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--accent-emerald);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  z-index: 50;
  pointer-events: auto;
}
.measure-floating-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #F8FAFC;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.measure-floating-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}
.measure-floating-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.measure-floating-btn.primary {
  background: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
}
.measure-floating-btn.primary:hover {
  background: #059669;
}

/* Floating Active Export Window Selection Banner */
.export-floating-banner {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  background: rgba(14, 21, 36, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(0, 229, 255, 0.3);
  border-radius: var(--radius-full);
  z-index: 60;
  pointer-events: auto;
  max-width: 95vw;
}
.export-banner-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.export-banner-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.4);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.export-banner-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #F8FAFC;
  white-space: nowrap;
}
.export-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.export-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.export-banner-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--accent-cyan);
}
.export-banner-btn.primary {
  background: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
}
.export-banner-btn.primary:hover {
  background: #059669;
}

/* Floating Dynamic Shape Drawing Controls Bar (Top-Center of Canvas) */
.draw-controls-bar {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #00E5FF;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 255, 0.25);
  border-radius: var(--radius-full);
  z-index: 60;
  pointer-events: auto;
  font-family: inherit;
  color: #F8FAFC;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.draw-controls-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #00E5FF;
  white-space: nowrap;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.draw-controls-icon {
  font-size: 1rem;
}

.draw-controls-title {
  color: #FFFFFF;
}

.draw-controls-step {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94A3B8;
  margin-left: 2px;
}

.draw-controls-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.draw-param-group {
  display: inline-flex;
  align-items: center;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 3px 8px;
  gap: 5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.draw-param-group:focus-within {
  border-color: #00E5FF;
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
}

.draw-param-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #CBD5E1;
  white-space: nowrap;
  user-select: none;
}

.draw-num-input {
  width: 78px;
  background: transparent;
  border: none;
  color: #38BDF8;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  padding: 2px 0;
  outline: none;
  text-align: right;
}

.draw-num-input::-webkit-inner-spin-button,
.draw-num-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.draw-param-unit {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748B;
  user-select: none;
}

.draw-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.1);
  color: #38BDF8;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.draw-toggle-btn:hover {
  background: rgba(0, 229, 255, 0.2);
  color: #FFFFFF;
}

.draw-controls-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
}

.draw-controls-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #F8FAFC;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.draw-controls-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.draw-controls-btn.primary {
  background: #00E5FF;
  color: #0F172A;
  border-color: #00E5FF;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.draw-controls-btn.primary:hover {
  background: #38BDF8;
  border-color: #38BDF8;
}

.draw-controls-btn.chip {
  padding: 3px 8px;
  font-size: 0.7rem;
  border-radius: 4px;
}

/* In-Canvas Heads-Up Dynamic Dimension Input (AutoCAD Dynamic Input / HUD) */
.cad-dynamic-hud {
  position: absolute;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 229, 255, 0.5);
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.6), 0 0 14px rgba(0, 229, 255, 0.2);
  border-radius: 8px;
  pointer-events: auto;
  user-select: none;
  font-family: inherit;
  min-width: 170px;
  transform: translate(15px, 15px);
  transition: opacity 0.12s ease;
}

.dynamic-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.dynamic-hud-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #38BDF8;
}

.dynamic-hud-badge {
  font-size: 0.62rem;
  font-weight: 700;
  color: #00E5FF;
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 4px;
  padding: 1px 4px;
}

.dynamic-hud-inputs {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dynamic-hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 3px 8px;
  gap: 6px;
  transition: all 0.15s ease;
}

.dynamic-hud-row:focus-within {
  border-color: #00E5FF;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.25);
}

.dynamic-hud-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94A3B8;
  white-space: nowrap;
}

.dynamic-hud-input {
  width: 85px;
  background: transparent;
  border: none;
  color: #00E5FF;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  outline: none;
  padding: 2px 0;
}

.dynamic-hud-input::-webkit-inner-spin-button,
.dynamic-hud-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.dynamic-hud-unit {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748B;
}

.dynamic-hud-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.65rem;
  color: #64748B;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 2px;
}

.dynamic-hud-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: inherit;
  font-size: 0.62rem;
  color: #CBD5E1;
}

/* Floating CAD Tool Palette Ribbon */
.cad-tool-palette {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(11, 17, 30, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 15;
  box-shadow: var(--shadow-md);
  max-height: calc(100% - 80px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* 2-Column Grid Layout for Compact Viewports */
.cad-tool-palette.palette-2col {
  width: 72px;
}
.cad-tool-palette.palette-2col .palette-group {
  display: grid;
  grid-template-columns: repeat(2, 28px);
  gap: 3px;
  justify-content: center;
}
.cad-tool-palette.palette-2col .palette-group-label {
  grid-column: span 2;
}

.palette-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 3px;
}
.palette-header-title {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.palette-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all var(--transition-fast);
}
.palette-toggle-btn:hover {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
}

.palette-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 3px;
  margin-bottom: 3px;
  border-bottom: 1px solid var(--border-subtle);
}
.palette-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.palette-group-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
  text-align: center;
  padding: 1px 0;
}

.palette-btn {
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}
.palette-btn svg {
  width: 15px;
  height: 15px;
}

.palette-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.palette-btn.active {
  background: rgba(0, 229, 255, 0.18);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.palette-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  background: #0E1524;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  z-index: 50;
}

.palette-btn:hover[data-tooltip]::after {
  opacity: 1;
  visibility: visible;
}

/* AutoCAD Classic Command Line Bar */
.cad-cli-bar {
  position: absolute;
  bottom: 34px;
  left: 0;
  right: 0;
  background: rgba(8, 12, 20, 0.94);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-medium);
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 12;
  font-family: var(--font-mono);
}

.cli-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cli-prompt {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.cli-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}
.cli-input::placeholder {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.cli-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.cli-chip {
  background: #111A2C;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 2px 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.cli-chip:hover {
  background: #1B2944;
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Interactive Status Pill */
.status-pill.clickable {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}
.status-pill.clickable:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
}
.status-pill.active {
  color: var(--accent-cyan);
  border-color: rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.12);
}

/* Toast Notification */
.viewer-toast {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(14, 21, 36, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-glow), var(--shadow-md);
  z-index: 100;
  display: none;
  animation: fadeIn 0.2s ease;
}

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

/* Modal Dialogs */
.cad-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cad-modal-backdrop.is-open {
  display: flex;
}

.cad-modal {
  background: #0E1524;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow), var(--shadow-md);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.cad-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cad-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.cad-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  line-height: 1;
}
.cad-modal-close:hover {
  color: var(--text-main);
}

.cad-modal-body {
  padding: 18px;
}

.cad-modal-footer {
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group select, .form-group input[type="text"], .form-group input[type="number"] {
  width: 100%;
  background: #162035;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
}
.form-group select:focus, .form-group input:focus {
  border-color: var(--accent-cyan);
}

/* Dropdown Menu Styles */
.dropdown-wrap {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #0E1524;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4);
  min-width: 260px;
  padding: 6px 0;
  z-index: 1050;
  display: none;
}

.dropdown-menu.is-open {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-main);
  font-size: 0.83rem;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
  outline: none;
}

.dropdown-item:hover {
  background: rgba(0, 229, 255, 0.12);
  color: var(--accent-cyan);
}

/* =========================================================================
   Drawing Loading Progress Dialog (matching Android DrawingLoadingDialog)
   ========================================================================= */
.cad-loading-modal-card {
  max-width: 380px !important;
  text-align: center;
  padding: 32px 28px 24px 28px;
  background: #0E1524;
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 229, 255, 0.15);
  border-radius: 18px;
}

.cad-loading-gauge-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto 18px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cad-loading-svg {
  width: 110px;
  height: 110px;
  transform: rotate(-90deg);
  overflow: visible;
}

.cad-loading-track {
  fill: none;
  stroke: rgba(56, 189, 248, 0.16);
}

.cad-loading-bar {
  fill: none;
  stroke: #00E5FF;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.65));
  transition: stroke-dashoffset 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.cad-loading-pct-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cad-loading-pct {
  font-size: 1.5rem;
  font-weight: 800;
  color: #F8FAFC;
  font-family: var(--font-mono, monospace);
  letter-spacing: -0.5px;
}

.cad-loading-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #F8FAFC;
  margin: 0 0 6px 0;
  word-break: break-all;
  line-height: 1.35;
}

.cad-loading-status {
  font-size: 0.85rem;
  color: #94A3B8;
  margin: 0 0 16px 0;
  min-height: 1.25rem;
  transition: color 0.15s ease;
}

.cad-loading-track-bar {
  width: 100%;
  height: 6px;
  background: rgba(56, 189, 248, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

.cad-loading-line-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00E5FF, #38BDF8, #818CF8);
  border-radius: 999px;
  transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

/* Language selector dropdown */
.lang-selector-wrap {
  position: relative;
  display: inline-block;
}

.lang-dropdown-menu {
  max-height: 340px;
  overflow-y: auto;
  min-width: 220px;
  right: 0;
  left: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) var(--bg-tertiary);
}

.lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
}

.lang-item.is-active {
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* RTL layout support for Arabic and Hebrew */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .dropdown-menu {
  left: 0;
  right: auto;
  text-align: right;
}

[dir="rtl"] .dropdown-item {
  text-align: right;
}

[dir="rtl"] .viewer-statusbar {
  direction: rtl;
}

[dir="rtl"] .lang-dropdown-menu {
  left: 0;
  right: auto;
}

/* ==========================================================================
   CAD Export Studio & Live Sheet Preview Styles
   ========================================================================== */

.cad-modal.export-studio-modal {
  max-width: 1040px;
  width: 95vw;
  height: 88vh;
  max-height: 880px;
  display: flex;
  flex-direction: column;
  background: #0E1524;
  border: 1px solid var(--border-medium);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 30px rgba(0, 229, 255, 0.2);
}

.export-studio-modal .cad-modal-header {
  padding: 12px 20px;
  background: #111A2C;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.export-studio-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.export-studio-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #10B981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.export-studio-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 860px) {
  .export-studio-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow-y: auto;
  }
}

/* Left Column: Settings Panel */
.export-settings-panel {
  padding: 16px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) var(--bg-tertiary);
  background: #0B111E;
}

.export-settings-panel::-webkit-scrollbar {
  width: 6px;
}
.export-settings-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
}
.export-settings-panel::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

/* Modular Settings Card */
.export-card {
  background: rgba(17, 26, 44, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.export-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-cyan);
}

.export-card-title svg {
  color: var(--accent-cyan);
}

.export-card-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Format Selector Grid */
.export-format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.export-format-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  background: rgba(14, 21, 36, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-dim);
  text-align: center;
}

.export-format-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--text-main);
}

.export-format-btn.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
  color: #FFFFFF;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
}

.export-format-tag {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.export-format-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.export-format-btn.active .export-format-sub {
  color: var(--accent-cyan);
}

/* Segmented Pill Group */
.export-pill-group {
  display: flex;
  background: rgba(8, 13, 24, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.export-pill-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.export-pill-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.export-pill-btn.active {
  background: var(--accent-cyan);
  color: #050B14;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 229, 255, 0.35);
}

/* Watermark Chip Presets */
.export-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.export-chip {
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.export-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.export-chip.active {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Right Column: Live Sheet Preview Panel */
.export-preview-panel {
  display: flex;
  flex-direction: column;
  background: #080D18;
  border-left: 1px solid var(--border-subtle);
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.export-preview-header {
  padding: 10px 16px;
  background: rgba(14, 21, 36, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 5;
}

.export-preview-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-preview-header-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.export-preview-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.export-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.export-preview-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.export-preview-btn.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Sheet & Canvas Container */
.export-sheet-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    radial-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.export-sheet-paper {
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.25s ease;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}

.export-sheet-paper.night-mode {
  background: #0B111E;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 229, 255, 0.2), 0 0 0 1px rgba(0, 229, 255, 0.3);
}

#exportPreviewCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
}

/* Live Preview Stats & Metadata Badge */
.export-preview-meta {
  padding: 8px 16px;
  background: rgba(14, 21, 36, 0.95);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.export-meta-pill {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-cyan);
}

.export-studio-footer-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}


