/* ========== Robic App Styles ========== */
/* Gebaseerd op de bestaande website styling */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html:focus-within {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell,
    "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  margin: 0;
  padding-left: 1.15rem;
}

p {
  margin: 0 0 1rem;
}

h1, h2, h3, h4 {
  line-height: 1.2;
  margin: 0 0 0.75rem;
  color: var(--color-heading);
}

h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
h3 { font-size: 1.25rem; }

/* ---------- Variables ---------- */
:root {
  --container-width: 1200px;
  --color-bg: #f6f8fb;
  --color-bg-alt: #eef3f8;
  --color-surface: #ffffff;
  --color-surface-2: #fbfdff;
  --color-text: #1f2a37;
  --color-heading: #0f172a;
  --color-muted: #3b3d42;
  --color-border: #dbe5f1;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #3b82f6;
  --color-accent-1: #06b6d4;
  --color-accent-2: #8b5cf6;
  --color-accent-3: #ec4899;
  --color-outline: #1f2a37;
  --color-success: #16a34a;
  --color-success-light: #dcfce7;
  --color-danger: #dc2626;
  --color-danger-light: #fee2e2;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 14px 40px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 64px rgba(15, 23, 42, 0.12);
  --radius: 14px;
}

/* ---------- Layout ---------- */
.container {
  width: min(var(--container-width), calc(100% - 2rem));
  margin-inline: auto;
}

.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  padding: 2rem 0;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 248, 251, 0.86);
  border-bottom: 1px solid rgba(219, 229, 241, 0.9);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s ease;
  text-decoration: none;
}

.logo:hover {
  transform: translateY(-1px);
}

.logo img {
  height: 1rem;
  padding: 1px 0;
  padding-top: 1.5px;
}

.logo-text {
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
  color: #2258d0;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.app-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.app-nav a {
  font-size: 0.95rem;
  color: var(--color-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
  transition: background 0.3s ease, color 0.3s ease;
  position: relative;
}

.app-nav a.btn {
  color: #fff;
  text-decoration: none;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.app-nav a:hover,
.app-nav a.active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-heading);
}

.app-nav a.btn:hover {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.app-nav a.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-1));
  transform: translateX(-50%);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-user-name {
  font-size: 0.9rem;
  color: var(--color-muted);
  font-weight: 600;
}

/* Mobile nav toggle */
.menu-toggle {
  display: none;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 0.55rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-heading);
  border-radius: 99px;
  margin: 5px auto;
  transition: all 0.3s ease;
}

/* ---------- Footer ---------- */
.app-footer {
  background: var(--color-heading);
  color: #94a3b8;
  padding: 2rem 0;
  margin-top: auto;
  text-align: center;
  font-size: 0.9rem;
}

.app-footer a {
  color: var(--color-accent-1);
  transition: color 0.2s ease;
}

.app-footer a:hover {
  color: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.05rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-secondary {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(6, 182, 212, 0.06));
  border-color: rgba(37, 99, 235, 0.2);
  color: var(--color-heading);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.12);
}

.btn-outline {
  background: #fff;
  border-color: var(--color-border);
  color: var(--color-heading);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.04);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

.btn-success {
  background: var(--color-success);
  color: #fff;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: 14px;
}

.btn-small {
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon {
  padding: 0.6rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--color-primary);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem 2.25rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: var(--shadow-lg);
}

.card-clickable {
  cursor: pointer;
}

.card-flat {
  box-shadow: none;
}

.card-flat:hover {
  transform: none;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 650;
  color: var(--color-heading);
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: 0.95rem;
  color: var(--color-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%233b3d42'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.2em;
  padding-right: 2.5rem;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.3rem;
}

.form-error {
  font-size: 0.85rem;
  color: var(--color-danger);
  margin-top: 0.3rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ---------- Checkbox & Toggle ---------- */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  transition: all 0.2s ease;
  cursor: pointer;
}

.checkbox-group:hover {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.02);
}

.checkbox-group.checked {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.04);
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.checkbox-label {
  flex: 1;
}

.checkbox-label-title {
  font-weight: 600;
  color: var(--color-heading);
  font-size: 0.95rem;
}

.checkbox-label-desc {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.15rem;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-border);
  border-radius: 24px;
  transition: all 0.3s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.toggle input:checked + .toggle-slider {
  background: var(--color-primary);
}

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

/* Number stepper */
.number-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.number-stepper button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  transition: background 0.2s ease;
}

.number-stepper button:hover {
  background: rgba(37, 99, 235, 0.08);
}

.number-stepper input {
  width: 48px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.4rem 0;
  color: var(--color-heading);
  font-family: inherit;
}

.number-stepper input:focus {
  outline: none;
}

/* ---------- Radio group (nu/later) ---------- */
.timing-group {
  display: flex;
  gap: 0.5rem;
}

.timing-option {
  flex: 1;
  text-align: center;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  background: #fff;
}

.timing-option:hover {
  border-color: var(--color-primary);
}

.timing-option.active {
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-primary);
}

.timing-option input {
  display: none;
}

/* ---------- Alert / Toast ---------- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background: var(--color-success-light);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: #166534;
}

.alert-error {
  background: var(--color-danger-light);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: #991b1b;
}

.alert-warning {
  background: var(--color-warning-light);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #92400e;
}

.alert-info {
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.15);
  color: var(--color-primary);
}

/* Toast notification */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  background: var(--color-success);
  color: #fff;
}

.toast-error {
  background: var(--color-danger);
  color: #fff;
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--color-heading);
  border-bottom: 2px solid var(--color-border);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.data-table tbody tr {
  transition: background 0.2s ease;
}

.data-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.03);
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-primary {
  background: rgba(37, 99, 235, 0.1);
  color: var(--color-primary);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-light);
  color: #92400e;
}

.badge-muted {
  background: rgba(59, 61, 66, 0.1);
  color: var(--color-muted);
}

/* ---------- Page header ---------- */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--color-muted);
  font-size: 1.05rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ---------- Auth layout ---------- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) + 4px);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo .logo-text {
  font-size: 1.5rem;
}

.auth-card h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--color-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.auth-footer a {
  color: var(--color-primary);
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ---------- Grid layouts ---------- */
.grid {
  display: grid;
  gap: 1.75rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Feature card ---------- */
.feature-card {
  position: relative;
}

.feature-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-primary);
  flex-shrink: 0;
}

.feature-icon svg {
  width: 20px;
  height: 20px;
}

.feature-card .card-category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--color-muted);
  flex: 1;
}

.feature-card .feature-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.feature-days {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-heading);
}

.feature-price {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-primary);
}

.feature-vibe-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px dashed var(--color-border);
  font-size: 0.85rem;
}

.feature-vibe-price .vibe-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-primary);
  font-weight: 600;
}

.feature-vibe-price .vibe-label svg {
  flex-shrink: 0;
}

.feature-vibe-price .vibe-price {
  font-weight: 700;
  color: var(--color-primary);
}

.vibe-cost-row span {
  color: var(--color-primary);
  font-weight: 600;
}

.vibe-cost-row strong {
  color: var(--color-primary);
}

/* ---------- Project card ---------- */
.project-card h3 {
  margin-bottom: 0.5rem;
}

.project-card .project-desc {
  color: var(--color-muted);
  font-size: 0.9rem;
  flex: 1;
}

.project-card .project-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* ---------- Quote / Order ---------- */
.quote-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.quote-section h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-border);
}

.quote-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(219, 229, 241, 0.5);
}

.quote-line:last-child {
  border-bottom: none;
}

.quote-line-name {
  flex: 1;
  font-size: 0.95rem;
}

.quote-line-detail {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-left: 1rem;
  white-space: nowrap;
}

.quote-line-price {
  font-weight: 700;
  color: var(--color-heading);
  min-width: 100px;
  text-align: right;
}

.quote-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0;
  margin-top: 0.5rem;
  border-top: 3px solid var(--color-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-heading);
}

.quote-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  font-weight: 600;
  color: var(--color-heading);
  border-top: 1px solid var(--color-border);
}

/* ---------- Quote feature breakdown ---------- */
.quote-feature {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(219, 229, 241, 0.5);
}

.quote-feature:last-child {
  border-bottom: none;
}

.quote-feature .quote-line {
  padding: 0;
  border-bottom: none;
}

[contenteditable][data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--color-muted);
  opacity: 0.5;
  pointer-events: none;
}

.quote-breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  margin-bottom: 0.15rem;
}

.quote-breakdown td {
  padding: 0.2rem 0.5rem 0.2rem 1.25rem;
  color: var(--color-muted);
}

.quote-breakdown td:first-child {
  padding-left: 1.75rem;
}

.quote-breakdown td:nth-child(2) {
  text-align: right;
  white-space: nowrap;
  width: 100px;
}

.quote-breakdown td:nth-child(3) {
  text-align: right;
  white-space: nowrap;
  width: 110px;
  font-variant-numeric: tabular-nums;
}

.quote-breakdown .qb-indent td:first-child {
  padding-left: 2.75rem;
  position: relative;
}

.quote-breakdown .qb-indent td:first-child::before {
  content: '\203A';
  position: absolute;
  left: 1.75rem;
  color: var(--color-muted);
  font-weight: 700;
}

.quote-breakdown .qb-muted td {
  color: var(--color-muted);
  font-style: italic;
}

.quote-breakdown .qb-sub td {
  border-top: 1px dashed var(--color-border);
  font-weight: 600;
  color: var(--color-text);
  padding-top: 0.3rem;
}

.quote-breakdown .qb-total td {
  border-top: 1.5px solid var(--color-heading);
  font-weight: 700;
  color: var(--color-heading);
  padding-top: 0.35rem;
  padding-bottom: 0.1rem;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  color: var(--color-heading);
  margin-bottom: 0.5rem;
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 2rem;
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}

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

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-surface);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
  font-size: 1.2rem;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  color: var(--color-muted);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--color-danger);
}

.modal-body {
  padding: 2rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--color-border);
}

/* ---------- Loading spinner ---------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-white {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  gap: 0.75rem;
  color: var(--color-muted);
}

/* ---------- Section dividers ---------- */
.section-divider {
  height: 1px;
  background: var(--color-border);
  margin: 2rem 0;
}

/* ---------- Feature detail ---------- */
.feature-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.feature-detail-header .badge {
  margin-bottom: 0.5rem;
}

.feature-detail-body {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
}

@media (max-width: 900px) {
  .feature-detail-body {
    grid-template-columns: 1fr;
  }
}

.feature-options-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: sticky;
  top: 5rem;
}

.feature-options-panel h3 {
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(219, 229, 241, 0.5);
}

.option-item:last-child {
  border-bottom: none;
}

.option-info {
  flex: 1;
}

.option-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-heading);
}

.option-effect {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* ---------- Cost breakdown ---------- */
.cost-summary {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(6, 182, 212, 0.03));
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}

.cost-row.total {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-heading);
  border-top: 2px solid rgba(37, 99, 235, 0.2);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
}

/* ---------- Search / Filter ---------- */
.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-bar input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-bar svg {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-muted);
  opacity: 0.5;
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-chip {
  padding: 0.4rem 1rem;
  border-radius: 99px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  color: var(--color-muted);
}

.filter-chip:hover {
  border-color: var(--color-primary);
}

.filter-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--color-primary);
  font-weight: 600;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .separator {
  opacity: 0.4;
}

/* ---------- Responsive Mobile Nav ---------- */
@media (max-width: 860px) {
  .menu-toggle {
    display: block;
  }

  .app-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    padding: 1rem;
    gap: 0.25rem;
  }

  .app-nav.open {
    display: flex;
  }

  .app-nav .nav-links {
    flex-direction: column;
    gap: 0.25rem;
  }

  .app-nav a {
    width: 100%;
    padding: 0.75rem 1rem;
  }

  .nav-user {
    width: 100%;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border);
    margin-top: 0.5rem;
  }

  .feature-detail-body {
    grid-template-columns: 1fr;
  }

  .feature-options-panel {
    position: static;
  }
}

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--color-primary); }
.text-muted { color: var(--color-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* Print styles for quote */
@media print {
  .app-header, .app-footer, .app-nav, .btn, .no-print, .breadcrumb {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .card, .quote-section {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
  .quote-feature {
    break-inside: avoid;
  }
  .quote-breakdown td {
    color: #555 !important;
  }
  .quote-breakdown .qb-total td {
    color: #000 !important;
  }
  .quote-logo {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    margin-bottom: 1rem;
  }
  .quote-logo img {
    height: 36px;
  }
  .quote-logo div {
    display: block !important;
  }
  .quote-logo strong {
    color: #000 !important;
  }
  .quote-logo a {
    color: #333 !important;
    text-decoration: none !important;
    font-size: 0.85rem !important;
  }
  .print-only {
    display: block !important;
  }
  .quote-title-editable {
    border-bottom: none !important;
  }
  /* Hide draft-only UI elements when printing */
  .drag-handle,
  .feature-drop-zone .drop-empty,
  .quote-feature-actions,
  textarea {
    display: none !important;
  }
  [contenteditable] {
    border-bottom: none !important;
    cursor: default !important;
    outline: none !important;
    min-height: 0 !important;
    padding-bottom: 0 !important;
  }
  [contenteditable]:empty {
    display: none !important;
  }
  [data-placeholder]:empty::before {
    display: none !important;
  }
  .draggable-quote-feature,
  .draggable-card {
    cursor: default !important;
  }
}

/* ---- Admin styles ---- */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.5rem;
}

.admin-tabs .tab {
  background: none;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

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

.admin-tabs .tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.admin-table th {
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  background: var(--color-surface);
}

.admin-table tr:hover td {
  background: var(--color-surface);
}

.form-select-small {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  min-width: auto;
}

.form-select-compact {
  appearance: none;
  background-image: none;
  padding-right: 0.5rem;
  cursor: pointer;
  text-align: center;
  min-width: 3rem;
}

/* ---- Timeline section ---- */
.timeline-section {
  margin-bottom: 1rem;
}

.timeline-header h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.timeline-card {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.timeline-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* ---- Responsive admin table ---- */
@media (max-width: 768px) {
  .admin-table th,
  .admin-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
  }
}

/* ========== AI Advisor & Chat ========== */
.app-main-fullscreen {
  padding: 0;
  overflow: hidden;
}

.advisor-layout {
  display: flex;
  height: calc(100vh - 62px - 52px);
  overflow: hidden;
}

.advisor-proposal {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
}

.advisor-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.advisor-layout.no-proposal .advisor-proposal {
  display: none;
}

.advisor-layout.no-proposal .advisor-chat {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* ---- Chat Messages ---- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-muted);
  padding: 3rem 1rem;
  flex: 1;
}

.chat-welcome svg {
  width: 56px;
  height: 56px;
  margin-bottom: 1rem;
  opacity: 0.4;
  stroke: var(--color-primary);
}

.chat-welcome h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--color-heading);
}

.chat-welcome p {
  max-width: 420px;
  line-height: 1.6;
}

/* ---- Chat Header ---- */
.chat-header {
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  min-height: 0;
}

.chat-header:empty,
.chat-header:has(> [style*="display: none"]:only-child) {
  display: none;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  gap: 0.35rem;
  display: inline-flex;
  align-items: center;
}

/* ---- Centered Chat Welcome (empty state) ---- */
.chat-welcome-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-muted);
  padding: 2rem 1rem;
  flex: 1;
  min-height: 0;
}

.advisor-chat.chat-empty .chat-messages {
  justify-content: center;
}

.chat-welcome-centered > svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1.25rem;
  opacity: 0.35;
  stroke: var(--color-primary);
}

.chat-welcome-centered h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--color-heading);
}

.chat-welcome-centered p {
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.chat-welcome-input {
  width: 100%;
  max-width: 560px;
}

.chat-welcome-input .chat-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-welcome-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s;
}

.chat-welcome-input textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-welcome-input .chat-send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-welcome-input .chat-send-btn svg {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px;
  min-height: 22px;
  display: block;
}

/* ---- Tool Logos ---- */
.tool-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.tool-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-bg-alt, #f3f4f6);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem 0.2rem 0.3rem;
  font-size: 0.78rem;
  color: var(--color-text);
  white-space: nowrap;
}

.tool-logo-badge img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ---- Markdown code blocks in chat ---- */
.chat-message.assistant pre {
  background: var(--color-bg-alt, #f3f4f6);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.5rem 0;
  font-size: 0.88em;
}

.chat-message.assistant pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.chat-message.assistant h2,
.chat-message.assistant h3,
.chat-message.assistant h4 {
  color: var(--color-heading);
  margin: 0.75rem 0 0.25rem;
  font-size: 1.05em;
}

.chat-message.assistant h2 { font-size: 1.15em; }
.chat-message.assistant h3 { font-size: 1.05em; }
.chat-message.assistant h4 { font-size: 1em; }

.chat-message {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-message.user {
  align-self: flex-end;
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.chat-message.assistant {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 0.25rem;
  white-space: normal;
}

.chat-message.assistant p {
  margin: 0 0 0.5rem;
}

.chat-message.assistant p:last-child {
  margin-bottom: 0;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
  margin: 0.25rem 0 0.5rem;
}

.chat-message.assistant strong {
  color: var(--color-heading);
}

.chat-message.assistant code {
  background: var(--color-bg-alt);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.chat-message.typing {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 0.25rem;
  padding: 0.75rem 1.25rem;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-muted);
  opacity: 0.4;
  animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ---- Chat Input ---- */
.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.chat-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input-wrap textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  line-height: 1.4;
  max-height: 120px;
  overflow-y: auto;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s;
}

.chat-input-wrap textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0 !important;
  border-radius: 0.75rem !important;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-btn svg {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px;
  min-height: 22px;
  flex-shrink: 0;
  display: block;
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-actions-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0 1.5rem 0.5rem;
  background: var(--color-bg);
}

/* ---- Proposal Panel ---- */
.proposal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--color-muted);
  padding: 2rem;
}

.proposal-empty svg {
  width: 56px;
  height: 56px;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.proposal-header {
  margin-bottom: 1.5rem;
}

.proposal-header h2 {
  margin-bottom: 0.25rem;
  font-size: 1.3rem;
}

.proposal-header p {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.proposal-feature-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.proposal-feature-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
}

.proposal-feature-item h4 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.proposal-feature-item .feature-meta {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.proposal-feature-desc {
  font-size: 0.85rem;
  color: var(--color-text);
  margin: 0.3rem 0 0.5rem;
  line-height: 1.5;
  opacity: 0.85;
}

.proposal-detail-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.4rem;
  background: var(--color-bg-alt, #f9fafb);
  border-radius: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
}

.proposal-detail-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.15rem 0;
  color: var(--color-muted);
}

.proposal-detail-line.proposal-detail-total {
  border-top: 1px solid var(--color-border);
  margin-top: 0.2rem;
  padding-top: 0.3rem;
  color: var(--color-heading);
}

.proposal-detail-value {
  font-family: monospace;
  white-space: nowrap;
}

.proposal-total {
  background: rgba(37, 99, 235, 0.06);
  border: 2px solid var(--color-primary);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.05rem;
}

.proposal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.proposal-actions .btn {
  flex: 1;
  min-width: 140px;
}

/* ---- Project Layout (two-column with inline chat) ---- */
.project-layout {
  display: flex;
  height: calc(100vh - 62px - 52px);
  overflow: hidden;
}

.project-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 2rem;
}

.project-chat-sidebar {
  width: 380px;
  min-width: 320px;
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
}

.chat-panel-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--color-bg);
  flex-shrink: 0;
}

.chat-panel-header button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--color-muted);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
}

.chat-panel-header button:hover {
  background: var(--color-bg-alt);
}

.project-chat-sidebar .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  gap: 0.75rem;
}

.project-chat-sidebar .chat-input-area {
  padding: 0.75rem;
  flex-shrink: 0;
}

.project-chat-sidebar .chat-input-wrap textarea {
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
}

.project-chat-sidebar .chat-message {
  max-width: 92%;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
}

/* Mobile toggle for project chat (only shown on small screens) */
.project-chat-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
  z-index: 901;
  transition: transform 0.2s, box-shadow 0.2s;
}

.project-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .advisor-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 62px - 52px);
  }

  .advisor-layout:not(.no-proposal) .advisor-proposal {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    max-height: 40vh;
    overflow-y: auto;
  }

  .advisor-layout:not(.no-proposal) .advisor-chat {
    min-height: 50vh;
  }

  .advisor-layout.no-proposal .advisor-chat {
    max-width: 100%;
  }

  .chat-message {
    max-width: 92%;
  }

  .chat-input-area {
    padding: 0.75rem 1rem;
  }

  /* Project layout: stack on mobile */
  .project-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 62px - 52px);
  }

  .project-content {
    padding: 1rem;
    overflow-y: visible;
  }

  .project-chat-sidebar {
    display: none;
    width: 100%;
    min-width: 100%;
    border-left: none;
    border-top: 1px solid var(--color-border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70vh;
    z-index: 900;
    border-radius: 1rem 1rem 0 0;
    box-shadow: var(--shadow-lg);
  }

  .project-chat-sidebar.open {
    display: flex;
  }

  .project-chat-toggle {
    display: flex;
  }
}

/* ---------- Security Test Results ---------- */
.security-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.security-result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: background 0.2s;
}

.security-result-item.result-fail {
  background: rgba(220, 38, 38, 0.04);
  border-color: rgba(220, 38, 38, 0.25);
}

.security-result-item.result-pass {
  background: rgba(22, 163, 74, 0.04);
  border-color: rgba(22, 163, 74, 0.15);
}

.security-result-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-heading);
  margin-bottom: 2px;
}

.security-result-detail {
  font-size: 0.82rem;
  color: var(--color-muted);
  line-height: 1.4;
}

.badge-danger {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.badge-success {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}

/* ===================================================================
   ANALYTICS PAGE
   =================================================================== */

.analytics-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.analytics-period {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analytics-period label {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.analytics-nav {
  display: flex;
  gap: 0.5rem;
}

/* KPI Grid */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.analytics-kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
}

.analytics-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.analytics-kpi-label {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

/* Sections */
.analytics-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.analytics-section h3 {
  font-size: 1rem;
  margin: 0 0 1rem 0;
  color: var(--color-text);
}

.analytics-section h4 {
  font-size: 0.85rem;
  margin: 0 0 0.75rem 0;
  color: var(--color-muted);
}

.analytics-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .analytics-grid-2 {
    grid-template-columns: 1fr;
  }
}

.analytics-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .analytics-split {
    grid-template-columns: 1fr;
  }
}

/* Table compact */
.admin-table-compact td,
.admin-table-compact th {
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
}

.analytics-page-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
}

.analytics-table-wrap {
  overflow-x: auto;
  max-height: 80vh;
  overflow-y: auto;
}

.analytics-table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

/* Bar Chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 180px;
  padding-top: 1rem;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.bar-fill {
  width: 100%;
  background: var(--color-primary);
  border-radius: 3px 3px 0 0;
  min-height: 0;
  position: relative;
  transition: height 0.3s ease;
}

.bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.bar-label {
  font-size: 0.6rem;
  color: var(--color-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

/* Pie / Horizontal bar list */
.pie-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pie-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
}

.pie-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.pie-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 4px;
  min-width: 4px;
}

.pie-label {
  font-size: 0.8rem;
  color: var(--color-text);
  white-space: nowrap;
}

.pie-value {
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}

/* Funnel */
.analytics-funnel {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.funnel-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  min-width: 100px;
}

.funnel-step-warn {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.funnel-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.funnel-step-warn .funnel-count {
  color: #ef4444;
}

.funnel-label {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

.funnel-arrow {
  font-size: 1.5rem;
  color: var(--color-muted);
}

/* Details */
.analytics-details {
  margin-top: 1rem;
}

.analytics-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-primary);
}

.analytics-details ul {
  margin-top: 0.5rem;
  padding-left: 1.5rem;
  font-size: 0.82rem;
}

.analytics-details li {
  margin-bottom: 0.25rem;
}

/* Session info */
.analytics-session-info {
  margin-bottom: 1.5rem;
}

.analytics-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.analytics-meta code {
  font-size: 0.78rem;
  background: var(--color-surface);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* Timeline */
.analytics-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 70px 32px 1fr;
  gap: 0.5rem;
  align-items: start;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-family: var(--font-mono, monospace);
  padding-top: 2px;
}

.timeline-icon {
  font-size: 1rem;
  text-align: center;
}

.timeline-content {
  min-width: 0;
}

.timeline-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 2px;
}

.timeline-desc {
  font-size: 0.82rem;
  line-height: 1.4;
  word-break: break-word;
}

.timeline-desc code {
  font-size: 0.75rem;
  background: var(--color-surface);
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  word-break: break-all;
}

/* ── Drag & Drop feature reordering ── */
.draggable-card,
.draggable-quote-feature {
  transition: opacity 0.15s, box-shadow 0.15s;
}
.draggable-card:hover .drag-handle,
.draggable-quote-feature:hover .drag-handle {
  opacity: 0.8 !important;
}
.draggable-card.dragging,
.draggable-quote-feature.dragging {
  opacity: 0.35;
  box-shadow: none;
}
.draggable-card.drag-above,
.draggable-quote-feature.drag-above {
  box-shadow: 0 -3px 0 0 var(--color-primary);
}
.draggable-card.drag-below,
.draggable-quote-feature.drag-below {
  box-shadow: 0 3px 0 0 var(--color-primary);
}
.feature-drop-zone {
  min-height: 40px;
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s;
  border: 2px dashed transparent;
  padding: 2px;
}
.feature-drop-zone.drag-over {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--color-primary);
}
.drag-handle {
  touch-action: none;
}
@media (max-width: 600px) {
  .drag-handle {
    padding: 6px 4px !important;
  }
}

/* Timeline type coloring */
.timeline-pageview { border-left: 3px solid var(--color-primary); padding-left: 0.5rem; }
.timeline-click { border-left: 3px solid #f59e0b; padding-left: 0.5rem; }
.timeline-navigate { border-left: 3px solid #3b82f6; padding-left: 0.5rem; }
.timeline-scroll { border-left: 3px solid #8b5cf6; padding-left: 0.5rem; }
.timeline-input_focus { border-left: 3px solid #10b981; padding-left: 0.5rem; }
.timeline-form_submit { border-left: 3px solid #ef4444; padding-left: 0.5rem; }
.timeline-selftest { border-left: 3px solid #ec4899; padding-left: 0.5rem; }
.timeline-ai_chat { border-left: 3px solid #06b6d4; padding-left: 0.5rem; }
.timeline-time_on_page { border-left: 3px solid #6b7280; padding-left: 0.5rem; }

/* ── IP Exclusion ── */
.analytics-ip-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.analytics-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--color-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.analytics-toggle-label input[type="checkbox"] {
  accent-color: var(--color-primary);
  cursor: pointer;
}

.excluded-ips-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.excluded-ip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.excluded-ip-row code {
  font-size: 0.85rem;
}

.excluded-ips-quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.excluded-ip-quick-btn {
  font-size: 0.78rem !important;
  padding: 0.25rem 0.6rem !important;
}

.excluded-ip-quick-btn .text-muted {
  font-size: 0.72rem;
  margin-left: 0.25rem;
}

@media (max-width: 768px) {
  .analytics-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .analytics-ip-filter {
    margin-left: 0;
    width: 100%;
  }
}

/* ---- Language switcher ---- */
.app-lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border: 1.5px solid var(--color-border, #ddd);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-muted, #666);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
  cursor: pointer;
}
.app-lang-switch:hover {
  border-color: var(--color-primary, #2563eb);
  color: var(--color-primary, #2563eb);
}
.app-lang-switch svg {
  flex-shrink: 0;
}
.app-lang-switch-footer {
  border: none;
  padding: 0;
  font-weight: 600;
}
.app-lang-switch-footer:hover {
  border: none;
}

