:root {
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --orange-500: #f97316;
  --green-500: #22c55e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-100);
  color: var(--gray-700);
  line-height: 1.5;
}

/* ============================================ */
/* TOPBAR                                       */
/* ============================================ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--gray-800);
  z-index: 1100;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--gray-700);
}
.topbar-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  gap: 12px;
  position: relative;
}

/* Mode toggle — centered in topbar */
.mode-toggle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  background: var(--gray-700);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--gray-400);
  font-family: inherit;
  transition: all .15s;
}
.mode-btn:hover { color: var(--gray-200); }
.mode-btn.active {
  background: white;
  color: var(--gray-800);
}

/* Page selector in topbar */
.topbar-page-select {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-page-select label {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 600;
}
.topbar-page-select select {
  padding: 6px 12px;
  border: 1px solid var(--gray-600);
  border-radius: 6px;
  background: var(--gray-700);
  color: white;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.topbar-page-select select:focus {
  outline: none;
  border-color: var(--blue-500);
}

/* Current page indicator */
.topbar-current {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-300);
}

/* ============================================ */
/* DEVELOPER MODE (default)                     */
/* ============================================ */
.mode-dev .template-nav { display: block; top: 52px; height: calc(100vh - 52px); }
.mode-dev .estimate-panel { display: flex; top: 52px; height: calc(100vh - 52px); }
.mode-dev .main {
  margin-left: 220px;
  margin-right: 320px;
  padding: 32px;
  padding-top: 84px; /* topbar + spacing */
}
.mode-dev .topbar-page-select { display: none; }
.mode-dev .topbar-current { display: none; }

/* ============================================ */
/* PREVIEW MODE                                 */
/* ============================================ */
.mode-preview .template-nav { display: none; }
.mode-preview .estimate-panel { display: none; }
.mode-preview .topbar-current { display: none; }
.mode-preview .topbar-page-select { display: flex; }

.mode-preview {
  background: white;
}

.mode-preview .main {
  margin-left: 0;
  margin-right: 0;
  padding: 0;
  padding-top: 72px; /* topbar + extra spacing */
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.mode-preview .template-body {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* In preview mode: hide all dev annotations */
.mode-preview .component {
  border: none;
  border-radius: 0;
  margin: 0;
  background: transparent;
}
.mode-preview .component:hover { border-color: transparent; }
.mode-preview .component-label { display: none; }
.mode-preview .component-content { padding: 0; }
.mode-preview .estimate-badge { display: none; }
.mode-preview .section-desc { display: none; }
.mode-preview .component.selected {
  border: none;
  box-shadow: none;
}
.mode-preview .component-content a.wf-card {
  transition: box-shadow .15s, border-color .15s;
}
.mode-preview .component-content a.wf-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  border-color: var(--blue-500);
}

/* Hide template header in preview */
.mode-preview .template-section {
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.mode-preview .template-header { display: none; }
.mode-preview .template-body { padding: 0; }

/* === TEMPLATE NAV === */
.template-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: var(--gray-800);
  color: white;
  overflow-y: auto;
  z-index: 1000;
  padding: 16px 0;
  font-size: 13px;
}
.template-nav h3 {
  padding: 0 16px 12px;
  font-size: 14px;
  color: var(--gray-400);
  border-bottom: 1px solid var(--gray-700);
  margin-bottom: 8px;
}
.template-nav a {
  display: block;
  padding: 6px 16px;
  color: var(--gray-300);
  text-decoration: none;
  transition: background .15s;
  position: relative;
}
.template-nav a:hover { background: var(--gray-700); color: white; }
.template-nav a.active {
  background: var(--blue-600);
  color: white;
  font-weight: 600;
}
.template-nav a .code {
  display: inline-block;
  width: 32px;
  color: var(--blue-500);
  font-weight: 600;
  font-size: 11px;
}

/* Nav status dots container */
.nav-dots {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Shared dot styles */
.nav-status-dot,
.nav-feedback-dot,
.nav-notes-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.nav-status-dot.complete { background: var(--green-500); }
.nav-status-dot.incomplete {
  background: transparent;
  border: 1.5px solid var(--green-500);
}
.nav-feedback-dot { background: var(--orange-500); }
.nav-notes-dot { background: var(--blue-500); }
.nav-assignee-icon,
.ep-assignee-icon {
  font-size: 8px;
  line-height: 1;
}

/* === MAIN === */
.main { margin-left: 220px; margin-right: 320px; padding: 32px; }

/* === TEMPLATE SECTION === */
.template-section {
  background: white;
  border-radius: 12px;
  margin-bottom: 48px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  overflow: hidden;
}
.template-header {
  display: none;
  background: var(--gray-800);
  color: white;
  padding: 20px 28px;
}
.template-header h2 { font-size: 20px; }
.template-header p { color: var(--gray-400); font-size: 13px; margin-top: 4px; }

/* === COMPONENT === */
.component {
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  margin: 16px 20px;
  position: relative;
  background: var(--gray-50);
  overflow: hidden;
}
.mode-dev .component { cursor: pointer; }
.mode-dev .component:hover { border-color: var(--blue-500); }
.component-label {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--blue-600);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 0 0 6px 0;
  z-index: 2;
  letter-spacing: .5px;
}
.component-label.global { background: var(--gray-700); }
.component-label.shared { background: var(--blue-600); }
.component-label.unique { background: var(--orange-500); }
.component-label.jobs { background: #dc2626; }
.component-content { padding: 32px 20px 20px; }

/* === WIREFRAME ELEMENTS === */
.wf-placeholder {
  background: var(--gray-200);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 13px;
  font-style: italic;
}
.wf-img { height: 180px; width: 100%; }
.wf-img-sm { height: 100px; width: 100%; }
.wf-img-lg { height: 320px; width: 100%; }
.wf-text { height: 12px; background: var(--gray-300); border-radius: 3px; margin: 6px 0; }
.wf-text.short { width: 40%; }
.wf-text.medium { width: 65%; }
.wf-text.long { width: 90%; }
.wf-heading { height: 20px; background: var(--gray-400); border-radius: 3px; margin: 8px 0; }
.wf-heading.short { width: 30%; }
.wf-heading.medium { width: 50%; }
.wf-btn {
  display: inline-block;
  background: var(--blue-600);
  color: white;
  padding: 8px 24px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
}
.wf-btn.secondary {
  background: transparent;
  border: 2px solid var(--gray-400);
  color: var(--gray-600);
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }
.flex-row { display: flex; gap: 16px; align-items: center; }
.flex-wrap { display: flex; flex-wrap: wrap; gap: 12px; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.p-16 { padding: 16px; }

/* Card */
.wf-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.wf-card .wf-card-body { padding: 12px; }

/* Logo placeholder */
.wf-logo {
  width: 100px;
  height: 40px;
  background: var(--gray-200);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--gray-400);
}

/* Stat */
.wf-stat { text-align: center; padding: 12px; }
.wf-stat .number { font-size: 32px; font-weight: 800; color: var(--blue-600); }
.wf-stat .label { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* Nav wireframe */
.wf-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
}
.wf-nav-links { display: flex; gap: 20px; font-size: 12px; color: var(--gray-500); }
.wf-nav-links.main-links { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.wf-nav-main-link { color: inherit; text-decoration: none; }
.wf-nav-main-link.active { color: var(--blue-600) !important; }
.wf-nav-sub-link { color: inherit; text-decoration: none; }
.wf-nav-sub-link.active { color: var(--blue-600) !important; }
.wf-nav-links a:hover { color: var(--blue-600) !important; }
.wf-sector-label {
  display: inline-block;
  background: var(--orange-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 1px;
}
.wf-lang-switch { font-size: 11px; color: var(--gray-400); }

/* FAQ */
.wf-faq-item {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-bottom: 8px;
  padding: 12px 16px;
  background: white;
}
.wf-faq-item .question { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; }
.wf-faq-item .answer { font-size: 13px; color: var(--gray-500); margin-top: 8px; }

/* Quote */
.wf-quote {
  border-left: 4px solid var(--blue-600);
  padding: 16px 20px;
  background: white;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--gray-600);
}
.wf-quote .author { font-style: normal; font-weight: 600; margin-top: 8px; font-size: 13px; }

/* Step */
.wf-step { text-align: center; padding: 16px; }
.wf-step .step-number {
  width: 40px; height: 40px;
  background: var(--blue-600);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 8px;
}
.wf-step .step-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.wf-step .step-desc { font-size: 12px; color: var(--gray-500); }

/* Form */
.wf-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--gray-400);
  background: white;
}
.wf-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--gray-400);
  background: white;
  height: 80px;
}

/* Hero dark */
.wf-hero-dark {
  background: var(--gray-800);
  color: white;
  padding: 60px 40px;
  text-align: center;
  position: relative;
}
.wf-hero-dark h1 { font-size: 28px; margin-bottom: 12px; }
.wf-hero-dark p { color: var(--gray-400); max-width: 600px; margin: 0 auto; }

/* Footer */
.wf-footer {
  background: var(--gray-800);
  color: var(--gray-400);
  padding: 32px 20px 16px;
  font-size: 12px;
}
.wf-footer .footer-cols { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 24px; margin-bottom: 20px; }
.wf-footer h4 { color: white; font-size: 13px; margin-bottom: 8px; }
.wf-footer .footer-link { display: block; padding: 2px 0; color: var(--gray-400); }
.wf-footer .footer-bottom { border-top: 1px solid var(--gray-700); padding-top: 12px; text-align: center; }

/* Breadcrumb */
.wf-breadcrumb-wrapper {
  margin-top: 0;
  margin-bottom: 0;
}
.mode-preview .wf-breadcrumb-wrapper {
  margin-top: -40px;
  margin-bottom: -40px;
}
.wf-breadcrumb {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wf-breadcrumb-link {
  color: var(--gray-400);
  text-decoration: none;
}
.wf-breadcrumb-link:hover {
  color: var(--blue-600);
}
.wf-breadcrumb-sep {
  color: var(--gray-300);
}
.wf-breadcrumb-current {
  color: var(--gray-600);
}

/* Section description */
.section-desc {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 12px;
  font-style: italic;
}

/* Filter bar */
.wf-filter-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.wf-filter-tag {
  padding: 6px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  font-size: 12px;
  color: var(--gray-500);
}
.wf-filter-tag.active {
  background: var(--blue-600);
  color: white;
  border-color: var(--blue-600);
}

/* Gallery */
.wf-gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.wf-gallery .wf-placeholder:first-child { grid-row: span 2; height: 100%; min-height: 200px; }

/* Map */
.wf-map {
  width: 100%;
  height: 200px;
  background: var(--gray-200);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 14px;
}

/* Team */
.wf-team-member { text-align: center; }
.wf-team-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--gray-200);
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--gray-400);
}
.wf-team-member .name { font-weight: 600; font-size: 14px; }
.wf-team-member .role { font-size: 12px; color: var(--gray-500); }

/* Legend */
.legend {
  display: flex;
  gap: 20px;
  padding: 12px 20px;
  background: white;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 12px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.legend-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.legend-arrow {
  font-size: 12px;
  transition: transform 0.2s;
  color: var(--gray-400);
}
.legend-toggle.open .legend-arrow {
  transform: rotate(90deg);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }
.legend-dot.global { background: var(--gray-700); }
.legend-dot.shared { background: var(--blue-600); }
.legend-dot.unique { background: var(--orange-500); }
.legend-dot.jobs { background: #dc2626; }

.legend-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-indicator.complete { background: var(--green-500); }
.legend-indicator.incomplete {
  background: transparent;
  border: 1.5px solid var(--green-500);
  width: 7px;
  height: 7px;
}
.legend-indicator.feedback { background: var(--orange-500); }
.legend-indicator.notes { background: var(--blue-500); }

/* === ESTIMATE PANEL (right sidebar) === */
.estimate-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: white;
  border-left: 1px solid var(--gray-200);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
.estimate-panel-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.estimate-panel-header h3 {
  font-size: 14px;
  margin-bottom: 2px;
}
.estimate-panel-header p {
  font-size: 11px;
  color: var(--gray-400);
}
.estimate-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.estimate-panel-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--gray-400);
  font-size: 13px;
}
.estimate-panel-form {
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
}
.estimate-panel-form .ep-component-id {
  font-weight: 700;
  font-size: 12px;
  color: var(--blue-600);
  margin-bottom: 2px;
}
.estimate-panel-form .ep-component-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--gray-700);
}
.estimate-panel-form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.estimate-panel-form input,
.estimate-panel-form select,
.estimate-panel-form textarea {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  font-size: 13px;
  margin-bottom: 8px;
  background: white;
  color: var(--gray-700);
  font-family: inherit;
}
.estimate-panel-form textarea {
  height: 50px;
  resize: vertical;
}
.estimate-panel-form input:focus,
.estimate-panel-form select:focus,
.estimate-panel-form textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
.ep-save-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: var(--blue-600);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.ep-save-btn:hover { background: var(--blue-700); }
.ep-saved-indicator {
  font-size: 11px;
  color: var(--green-500);
  text-align: center;
  margin-top: 4px;
  opacity: 0;
  transition: opacity .3s;
}
.ep-saved-indicator.visible { opacity: 1; }

/* Component selected state */
.component.selected {
  border-color: var(--blue-600);
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* Component with estimate badge */
.component .estimate-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--green-500);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 0 0 0 6px;
  z-index: 2;
}

/* Summary footer in panel */
.estimate-panel-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.estimate-panel-footer .total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
}
.estimate-panel-footer .total-row.grand-total {
  font-weight: 700;
  font-size: 15px;
  border-top: 1px solid var(--gray-300);
  padding-top: 8px;
  margin-top: 4px;
}

/* Estimate list in panel body */
.ep-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .1s;
}
.ep-list-item:hover { background: var(--gray-50); }
.ep-list-item.active { background: rgba(37,99,235,.05); }
.ep-list-item .ep-item-label {
  font-size: 12px;
}
.ep-list-item .ep-item-label .ep-code {
  font-weight: 700;
  color: var(--blue-600);
  margin-right: 4px;
}
.ep-list-item .ep-item-hours {
  font-weight: 700;
  font-size: 12px;
  color: var(--gray-600);
  white-space: nowrap;
}
.ep-list-item .ep-item-hours.empty {
  color: var(--gray-300);
}

/* ============================================ */
/* LOGIN PAGE                                   */
/* ============================================ */
.login-page {
  background: var(--gray-800);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--gray-700);
  border-radius: 12px;
  padding: 25px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.login-header {
  margin-bottom: 24px;
  text-align: center;
}
.login-header h1 {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-header p {
  color: var(--gray-400);
  font-size: 13px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.login-form input[type="password"] {
  background: var(--gray-800);
  border: 1px solid var(--gray-600);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  color: #fff;
  outline: none;
  transition: border-color .15s;
}
.login-form input[type="password"]:focus {
  border-color: var(--blue-500);
}
.login-form button {
  background: var(--blue-600);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.login-form button:hover {
  background: var(--blue-700);
}
.login-error {
  color: #f87171;
  font-size: 13px;
  text-align: center;
}

/* ============================================ */
/* LOGOUT BUTTON                                */
/* ============================================ */
.topbar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--gray-400);
  text-decoration: none;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.topbar-logout:hover {
  background: var(--gray-700);
  color: #fff;
}

/* ============================================ */
/* CLIENT ROLE: hide toggle and dev elements    */
/* ============================================ */
.role-client .mode-toggle,
.role-client .template-nav,
.role-client .estimate-panel {
  display: none !important;
}

/* ============================================ */
/* CLIENT FEEDBACK SYSTEM                       */
/* ============================================ */

/* Subtle hover for clickable components (client role + dev in preview) */
.role-client .component,
.mode-preview .component {
  cursor: pointer;
  transition: outline .15s, outline-offset .15s;
  overflow: visible;
}
.role-client .component:hover,
.mode-preview .component:hover {
  outline: 2px solid var(--blue-500);
  outline-offset: -2px;
  border-color: transparent;
}

/* Feedback indicator dot on components */
.wf-feedback-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  background: var(--orange-500);
  border-radius: 50%;
  z-index: 5;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 0 0 2px white;
}
.wf-feedback-indicator:hover {
  transform: scale(1.6);
  box-shadow: 0 0 0 2px white, 0 2px 8px rgba(249,115,22,.4);
}

/* Preview/client mode: dot just outside right edge */
.mode-preview .wf-feedback-indicator {
  right: -18px;
  top: 12px;
}

/* Dev mode: position indicator differently (avoid overlap with badge) */
.mode-dev .wf-feedback-indicator {
  top: auto;
  bottom: 8px;
  right: 8px;
}

/* Ensure component can show popup without clipping */
.component:has(.wf-feedback-popup) {
  overflow: visible !important;
}

/* Feedback popup */
.wf-feedback-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  max-height: 500px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.05);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

/* Preview/client: popup inside component, top-right near the dot */
.mode-preview .wf-feedback-popup {
  position: absolute;
  top: 8px;
  right: -18px;
  left: auto;
  transform: none;
  max-height: 500px;
}
.wf-feedback-popup-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--gray-50);
}
.wf-feedback-popup-header h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-700);
}
.wf-feedback-popup-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}
.wf-feedback-popup-close:hover { color: var(--gray-700); }

.wf-feedback-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
}

/* Individual feedback item */
.wf-feedback-item {
  padding: 8px 10px;
  background: var(--gray-50);
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid var(--orange-500);
}
.wf-feedback-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.wf-feedback-item .wf-feedback-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.45;
}
.wf-feedback-item .wf-feedback-date {
  font-size: 11px;
  color: var(--gray-400);
}
.wf-feedback-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.wf-feedback-resolve,
.wf-feedback-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-300);
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  transition: color .15s;
}
.wf-feedback-resolve:hover { color: var(--green-500); }
.wf-feedback-delete:hover { color: #ef4444; }

/* Resolved feedback item */
.wf-feedback-item.resolved {
  opacity: 0.5;
}
.wf-feedback-item.resolved .wf-feedback-text {
  text-decoration: line-through;
}

.wf-feedback-empty {
  color: var(--gray-400);
  font-size: 12px;
  font-style: italic;
  padding: 8px 0;
}

/* Popup form area */
.wf-feedback-popup-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.wf-feedback-popup-footer textarea {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  max-height: 120px;
  color: var(--gray-700);
  background: white;
}
.wf-feedback-popup-footer textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
.wf-feedback-popup-footer button {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: var(--orange-500);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.wf-feedback-popup-footer button:hover { background: #ea580c; }

/* Dev estimate panel: client feedback section */
.ep-client-feedback {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-200);
  background: #fffbeb;
}
.ep-client-feedback-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--orange-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ep-client-feedback .wf-feedback-item {
  background: white;
}
.ep-copy-all-btn,
.ep-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  opacity: 0.4;
  transition: opacity .15s;
}
.ep-copy-all-btn {
  margin-left: auto;
}
.ep-copy-all-btn:hover,
.ep-copy-btn:hover {
  opacity: 1;
}

/* CSV export button in panel footer */
.ep-export-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  background: transparent;
  color: var(--gray-500);
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.ep-export-btn:hover {
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-400);
}


/* Status dots in dev panel component list */
.ep-item-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  margin-left: 8px;
}
.ep-status-dot,
.ep-feedback-dot,
.ep-notes-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ep-status-dot.complete { background: var(--green-500); }
.ep-status-dot.incomplete {
  background: transparent;
  border: 1.5px solid var(--green-500);
}
.ep-feedback-dot { background: var(--orange-500); }
.ep-notes-dot { background: var(--blue-500); }

/* ============================================ */
/* DASHBOARD                                    */
/* ============================================ */

/* Topbar dashboard link */
.topbar-dashboard-link {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  opacity: 0.4;
  transition: opacity .15s;
  white-space: nowrap;
}
.topbar-dashboard-link:hover { opacity: 0.7; }
.topbar-dashboard-link.active { opacity: 1; }

/* Hide estimate panel on dashboard, widen main */
.mode-dev .main:has(.dashboard-content) {
  margin-right: 0;
}
.mode-dev:has(.dashboard-content) .estimate-panel,
.mode-dev:has(.dashboard-content) .mode-toggle {
  display: none;
}

/* Dashboard two-column grid */
.dashboard-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.dashboard-column {
  min-width: 0;
}
.dashboard-column-header {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-200);
}
.dashboard-empty {
  color: var(--gray-400);
  font-size: 13px;
  font-style: italic;
  padding: 16px 0;
}

/* Day groups */
.dashboard-day-group {
  margin-bottom: 20px;
}
.dashboard-day-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gray-100);
}

/* Individual items */
.dashboard-item {
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid var(--orange-500);
}
.dashboard-item.resolved {
  opacity: 0.5;
}
.dashboard-item.resolved .wf-feedback-text {
  text-decoration: line-through;
}
.dashboard-note-item {
  border-left-color: var(--blue-500);
}
.dashboard-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
}
.dashboard-comp-link {
  font-weight: 700;
  color: var(--blue-600);
  text-decoration: none;
  font-size: 11px;
}
.dashboard-comp-link:hover {
  text-decoration: underline;
}
.dashboard-item-date {
  color: var(--gray-400);
}
.dashboard-person {
  color: var(--gray-500);
}
.dashboard-hours {
  font-weight: 700;
  color: var(--green-500);
  font-size: 11px;
}
.dashboard-note-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.45;
  white-space: pre-wrap;
}
.dashboard-item-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.dashboard-resolve-btn,
.dashboard-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  opacity: 0.4;
  transition: opacity .15s;
}
.dashboard-resolve-btn:hover,
.dashboard-copy-btn:hover {
  opacity: 1;
}

/* ============================================ */
/* SETTINGS PAGE                                */
/* ============================================ */

/* Hide panels on settings page (same as dashboard) */
.mode-dev .main:has(.settings-content) {
  margin-right: 0;
}
.mode-dev:has(.settings-content) .estimate-panel,
.mode-dev:has(.settings-content) .mode-toggle {
  display: none;
}

.settings-content {
  max-width: 600px;
  margin: 0 auto;
}
.settings-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 24px;
}
.settings-section {
  margin-bottom: 20px;
}
.settings-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.settings-input {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-700);
  background: white;
}
.settings-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
.settings-persons-list {
  margin-bottom: 8px;
}
.settings-person-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 14px;
}
.settings-person-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  transition: color .15s;
}
.settings-person-remove:hover {
  color: #ef4444;
}
.settings-person-add {
  display: flex;
  gap: 8px;
}
.settings-person-add .settings-input {
  flex: 1;
}
.settings-add-btn {
  padding: 8px 16px;
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  white-space: nowrap;
}
.settings-add-btn:hover {
  background: var(--gray-200);
}
.settings-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gray-700);
  cursor: pointer;
}
.settings-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.settings-password-wrapper {
  position: relative;
}
.settings-password-wrapper .settings-input {
  padding-right: 40px;
}
.settings-password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
}
.settings-password-toggle:hover {
  color: var(--gray-600);
}
.settings-save-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: var(--blue-600);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  margin-top: 8px;
}
.settings-save-btn:hover {
  background: var(--blue-700);
}
.settings-saved {
  font-size: 13px;
  color: var(--green-500);
  text-align: center;
  margin-top: 8px;
  opacity: 0;
  transition: opacity .3s;
}
.settings-saved.visible {
  opacity: 1;
}
