:root {
  --color-bg: #0a0f1c;
  --color-surface: #111a2e;
  --color-surface-2: #16213a;
  --color-border: #223052;
  --color-text: #e7ecf7;
  --color-muted: #97a3bf;
  --color-primary: #4f7cff;
  --color-primary-hover: #3d63e0;
  --color-danger: #ef4444;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--color-primary); text-decoration: none; }

h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }

/* ---- Landing ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 15, 28, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header, .dash-header {
  border-bottom: 1px solid var(--color-border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}
.brand { font-size: 20px; font-weight: 800; color: var(--color-text); }
.brand span { color: var(--color-primary); }
.brand small { color: var(--color-muted); font-weight: 400; margin-left: 6px; }
nav a { margin-left: 28px; color: var(--color-muted); font-size: 14px; font-weight: 500; transition: color 0.15s ease; }
nav a:hover { color: var(--color-text); }
nav a.btn-ghost { margin-left: 28px; }

.hero {
  padding: 120px 0 90px;
  text-align: center;
  background:
    radial-gradient(600px 300px at 50% -10%, rgba(79, 124, 255, 0.25), transparent 70%),
    var(--color-bg);
}
.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(79, 124, 255, 0.12);
  border: 1px solid rgba(79, 124, 255, 0.35);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 24px;
}
.hero h1 { font-size: 48px; max-width: 760px; margin: 0 auto 22px; }
.hero .lead { color: var(--color-muted); max-width: 620px; margin: 0 auto 36px; font-size: 18px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.hero-video-wrap { margin-top: 64px; }
.video-frame {
  max-width: 880px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.03);
  text-align: left;
}
.video-frame-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}
.video-frame-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.video-frame-dot.red { background: #ef4444; }
.video-frame-dot.amber { background: #f59e0b; }
.video-frame-dot.green { background: #22c55e; }
.video-frame-title {
  margin-left: 10px;
  font-size: 13px;
  color: var(--color-muted);
  font-weight: 500;
}
.video-frame video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

.btn-primary {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  padding: 13px 26px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(79, 124, 255, 0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); }
.btn-secondary {
  display: inline-block;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 13px 26px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn-secondary:hover { background: var(--color-surface-2); transform: translateY(-1px); }
.login-back-link { margin-top: 24px; text-align: center; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--color-border);
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--color-text) !important;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s ease;
}
.btn-ghost:hover { background: var(--color-border); }
.full-width { width: 100%; }

.section-tag {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.services { padding: 90px 0; }
.services h2 { text-align: center; margin-bottom: 12px; font-size: 32px; }
.section-lead { text-align: center; color: var(--color-muted); max-width: 520px; margin: 0 auto 44px; }

.legal-page { padding: 70px 0 100px; }
.legal-page .container { max-width: 720px; }
.legal-page h1 { font-size: 34px; margin-bottom: 6px; }
.legal-updated { color: var(--color-muted); font-size: 13px; margin-bottom: 36px; }
.legal-page h2 { font-size: 20px; margin: 36px 0 12px; }
.legal-page p, .legal-page li { color: var(--color-muted); line-height: 1.7; font-size: 15px; }
.legal-page ul { padding-left: 20px; margin-bottom: 12px; }
.legal-page a { color: var(--color-primary); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card {
  background: linear-gradient(180deg, var(--color-surface), var(--color-surface-2));
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 28px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-4px); border-color: rgba(79, 124, 255, 0.5); }
.card-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(79, 124, 255, 0.12);
  color: var(--color-primary);
  font-size: 20px;
  margin-bottom: 16px;
}
.card h3 { margin-top: 0; margin-bottom: 8px; font-size: 18px; }
.card p { color: var(--color-muted); margin: 0; font-size: 14.5px; }

.pricing { padding: 0 0 90px; }
.pricing h2 { text-align: center; margin-bottom: 12px; font-size: 32px; }
.pricing-card {
  background: linear-gradient(180deg, var(--color-surface), var(--color-surface-2));
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 36px;
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
}
.price-row { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin-bottom: 22px; }
.price-amount { font-size: 40px; font-weight: 800; }
.price-period { color: var(--color-muted); font-size: 15px; }
.price-features { list-style: none; margin: 0 0 26px; padding: 0; text-align: left; }
.price-features li {
  color: var(--color-muted);
  font-size: 14.5px;
  padding: 8px 0 8px 26px;
  position: relative;
  border-bottom: 1px solid var(--color-border);
}
.price-features li:last-child { border-bottom: none; }
.price-features li::before { content: "\2713"; position: absolute; left: 0; color: var(--color-primary); font-weight: 700; }
.price-disclaimer { color: var(--color-muted); font-size: 12.5px; max-width: 560px; margin: 20px auto 0; text-align: center; }

.testimonials { padding: 0 0 90px; }
.testimonials h2 { text-align: center; margin-bottom: 44px; font-size: 32px; }
.testimonial-card {
  background: linear-gradient(180deg, var(--color-surface), var(--color-surface-2));
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 36px;
  max-width: 640px;
  margin: 0 auto;
}
.testimonial-logo {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(79, 124, 255, 0.12);
  color: var(--color-primary);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
}
.testimonial-logo-badge {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 20px;
}
.testimonial-logo-img { height: 30px; width: auto; display: block; }
.testimonial-quote { font-size: 16px; color: var(--color-text); margin: 0 0 20px; }
.testimonial-author { display: flex; flex-direction: column; }
.testimonial-author strong { font-size: 14.5px; }
.testimonial-author span { color: var(--color-muted); font-size: 13.5px; }
.testimonial-company-desc { font-size: 12.5px; margin-top: 2px; opacity: 0.85; }

.process { padding: 0 0 90px; }
.process h2 { text-align: center; margin-bottom: 44px; font-size: 32px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.step { text-align: center; padding: 0 12px; }
.step-number {
  width: 40px; height: 40px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-primary);
  font-weight: 700;
}
.step h3 { margin: 0 0 8px; font-size: 17px; }
.step p { color: var(--color-muted); font-size: 14.5px; margin: 0; }

.contact { padding: 20px 0 110px; }
.contact-card {
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.15), var(--color-surface));
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 56px 40px;
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}
.contact-card h2 { font-size: 28px; margin: 0 0 12px; }
.contact-card p { color: var(--color-muted); margin: 0 0 28px; }
.contact-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.contact-form { margin-top: 36px; text-align: left; }
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 6px;
}
.form-row input, .form-row textarea {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--color-text);
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
}
.form-row input:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}
.form-row textarea { resize: vertical; }
/* Honeypot field: invisible and unreachable to real visitors, but still
   present in the DOM/tab order source so naive bots that auto-fill every
   input tend to fill it in. */
.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.contact-form-status { margin: 14px 0 0; font-size: 14px; color: var(--color-muted); min-height: 20px; }
.grecaptcha-badge { z-index: 5; }

.site-footer { border-top: 1px solid var(--color-border); padding: 40px 0 24px; color: var(--color-muted); font-size: 14px; }
.footer-grid { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 20px; margin-bottom: 24px; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--color-muted); font-size: 14px; }
.footer-links a:hover { color: var(--color-text); }
.internal-hint { font-size: 12px; opacity: 0.7; margin: 8px 0 0; }
.copyright { margin: 0; font-size: 13px; opacity: 0.7; }

@media (max-width: 640px) {
  .hero { padding: 90px 0 60px; }
  .hero h1 { font-size: 34px; }
  nav a:not(.btn-ghost) { display: none; }
}

/* ---- Login ---- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 360px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.subtitle { color: var(--color-muted); margin: 0 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 6px; }
.login-card label { font-size: 13px; color: var(--color-muted); margin-top: 10px; }
.login-card input, .login-card select, .login-card textarea {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.login-card button { margin-top: 20px; }
.error-msg { color: var(--color-danger); font-size: 14px; }

/* ---- Dashboard ---- */
.dash-main { padding: 32px 0 60px; }
.tab-nav { display: flex; gap: 8px; margin-bottom: 24px; border-bottom: 1px solid var(--color-border); }
.tab-btn {
  background: none;
  border: none;
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 4px;
  margin-right: 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-text); border-bottom-color: var(--color-primary); }
.dash-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.clients-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}
.clients-table th, .clients-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.clients-table th { color: var(--color-muted); font-weight: 600; }
.clients-table tr:last-child td { border-bottom: none; }
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.status-active { background: #16a34a33; color: #4ade80; }
.status-paused { background: #f59e0b33; color: #fbbf24; }
.status-inactive { background: #6b728033; color: #9ca3af; }

.lead-status-new { background: #3b82f633; color: #60a5fa; }
.lead-status-needs_contact_info { background: #f59e0b33; color: #fbbf24; }
.lead-status-contacted { background: #8b5cf633; color: #a78bfa; }
.lead-status-estimate_booked { background: #06b6d433; color: #22d3ee; }
.lead-status-won { background: #16a34a33; color: #4ade80; }
.lead-status-lost { background: #6b728033; color: #9ca3af; }

.lead-readonly p { margin: 4px 0; font-size: 13px; color: var(--color-muted); }
.lead-readonly strong { color: var(--color-text); }


.row-actions button {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 13px;
  margin-right: 8px;
}
.row-actions button:hover { color: var(--color-text); }
.row-actions .delete-btn:hover { color: var(--color-danger); }
.row-actions .toggle-status-btn:hover { color: #fbbf24; }

dialog {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog form { display: flex; flex-direction: column; }
dialog label { font-size: 13px; color: var(--color-muted); margin-top: 10px; }
dialog input, dialog select, dialog textarea {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.hidden { display: none !important; }

.ticket-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.ticket-key-row .msg { font-size: 12px; color: var(--color-muted); }

.internal-hint { font-size: 13px; color: var(--color-muted); margin-top: -8px; margin-bottom: 16px; }

#client-features-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.client-features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  max-height: 180px;
  overflow-y: auto;
}
.client-feature-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}
.client-feature-row input[type="checkbox"] { width: auto; }
.client-feature-row small { color: var(--color-muted); }
.client-feature-sync { flex-basis: 100%; margin-left: 22px; font-size: 11px; }
.client-feature-sync.sync-ok { color: #4caf82; }
.client-feature-sync.sync-warn { color: #d9a441; }

.ticket-key-copy-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.ticket-key-copy-row input {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
}
#ticket-key-copy-status { display: block; margin-top: 8px; }

.tickets-cell { text-align: center; }
.ticket-icon-btn {
  background: none;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ticket-icon-btn:hover { color: var(--color-text); }
.ticket-icon-btn.has-open { color: var(--color-primary); }
.ticket-badge {
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 1px 6px;
}

dialog#tickets-dialog { max-width: 560px; }

dialog.booking-dialog {
  max-width: 720px;
  width: 92vw;
  padding: 0;
  overflow: hidden;
}
.booking-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.booking-dialog-header h2 { margin: 0; font-size: 18px; }
.booking-iframe {
  width: 100%;
  height: min(640px, 75vh);
  border: none;
  display: block;
  background: #fff;
}
.tickets-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.tickets-dialog-header h2 { margin: 0; font-size: 18px; }

.ticket-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}
.ticket-list-item:hover { background: var(--color-surface-2); }
.ticket-list-item .ticket-subject { font-weight: 600; font-size: 14px; }
.ticket-list-item .ticket-meta { font-size: 12px; color: var(--color-muted); margin-top: 3px; }

.ticket-thread-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px 0 12px;
}
.ticket-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  white-space: pre-wrap;
}
.ticket-bubble.client { align-self: flex-start; background: var(--color-surface-2); }
.ticket-bubble.admin { align-self: flex-end; background: var(--color-primary); color: #fff; }
.ticket-bubble .ticket-bubble-meta { font-size: 11px; opacity: 0.75; margin-top: 4px; }
.ticket-bubble img { max-width: 100%; border-radius: 6px; margin-top: 6px; display: block; }

#ticket-reply-form textarea { width: 100%; margin-top: 4px; }
