@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --bg:               #fff8f1;
  --surface-white:    #ffffff;
  --surface-low:      #fbf3e4;
  --surface:          #f5eddf;
  --surface-high:     #f0e7d9;
  --surface-highest:  #eae1d4;
  --shell:            #25273A;
  --shell-text:       #ffffff;
  --yellow:           #FFDF00;
  --yellow-dark:      #d4b800;
  --on-yellow:        #1f1b13;
  --text:             #1f1b13;
  --text-muted:       #4d4635;
  --text-subtle:      #7f7663;
  --border:           #d0c5af;
  --border-subtle:    #e8dfd0;
  --danger:           #ba1a1a;
  --danger-bg:        #ffdad6;
  --success:          #3aa95c;
  --r:     4px;
  --r-lg:  8px;
  --font:      'Hanken Grotesk', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Mono', Menlo, monospace;
  --header-h:  64px;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Header ──────────────────────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--shell);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}

.header-left {
  display: flex;
  align-items: center;
  height: 100%;
}

.savills-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 16px;
}

.header-brand-sep {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,.2);
  margin-right: 16px;
}

.header-product {
  font-size: 15px;
  font-weight: 600;
  color: var(--shell-text);
  letter-spacing: -.01em;
  white-space: nowrap;
}

.header-nav-sep {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,.15);
  margin: 0 20px;
}

.header-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(255,255,255,.55);
  border-bottom: 3px solid transparent;
  transition: color .15s;
}
.nav-item:hover { color: rgba(255,255,255,.85); }
.nav-item--active {
  color: var(--yellow);
  border-bottom-color: var(--yellow);
}

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

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-highest);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.80); white-space: nowrap; }

.btn-signout {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.75);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  padding: 6px 14px;
  cursor: pointer;
  border-radius: var(--r);
  transition: border-color .15s, color .15s, background .15s;
}
.btn-signout:hover { border-color: rgba(255,255,255,.45); color: var(--shell-text); background: rgba(255,255,255,.06); }

/* ── Full-screen states ──────────────────────────────────────────────────── */

.state-fullscreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: calc(100vh - var(--header-h));
  color: var(--text-subtle);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--shell);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.unauth-card {
  background: var(--surface-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 40px 48px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 12px rgba(31,27,19,.08);
}
.unauth-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.unauth-card p  { font-size: 14px; color: var(--text-muted); line-height: 1.65; margin-bottom: 28px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 20px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  border-radius: var(--r);
  transition: background .15s;
}
.btn-ghost:hover { background: var(--surface-low); }

.error-text { color: var(--danger); font-size: 14px; }

/* ── Report shell ────────────────────────────────────────────────────────── */

.report-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h));
}

/* ── Controls bar ────────────────────────────────────────────────────────── */

.controls-bar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface-low);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.control-group--report { flex: 1; min-width: 260px; }

.control-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-subtle);
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  height: 48px;
  padding: 0 40px 0 14px;
  background: var(--surface-white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.select-wrap select:focus { border-color: var(--shell); box-shadow: 0 0 0 3px rgba(37,39,58,.06); }
.select-wrap select:disabled { opacity: .55; cursor: not-allowed; }

.select-chevron {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.btn-load {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 28px;
  background: var(--yellow);
  color: var(--on-yellow);
  border: none;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: .04em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-end;
  transition: background .15s;
}
.btn-load:hover:not(:disabled) { background: var(--yellow-dark); }
.btn-load:disabled { opacity: .4; cursor: not-allowed; }

/* ── Preview section ─────────────────────────────────────────────────────── */

.preview-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 24px 0;
  min-height: 0;
}

.preview-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-subtle);
}

.preview-badges { display: flex; gap: 8px; }

.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 9px;
  border-radius: 9999px;
}
.badge--neutral {
  background: var(--surface-highest);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.preview-frame-wrap {
  flex: 1;
  min-height: 0;
  background: var(--surface-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(31,27,19,.06);
}

.report-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

/* ── Embed code section ──────────────────────────────────────────────────── */

.embed-code-section {
  padding: 0 24px 20px;
  flex-shrink: 0;
}

.embed-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.embed-code-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-subtle);
}

.embed-code-block-wrap {
  position: relative;
}

.embed-code-block {
  background: #1e1f2e;
  border-radius: var(--r-lg);
  padding: 18px 20px;
  padding-top: 52px; /* room for the button */
  margin: 0;
  overflow-x: auto;
}

.embed-code-block code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #c9d1d9;
  white-space: pre;
}

.btn-copy-code {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow);
  color: var(--on-yellow);
  border: none;
  border-radius: var(--r);
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s;
}
.btn-copy-code:hover:not(:disabled) { background: var(--yellow-dark); }
.btn-copy-code:disabled { opacity: .4; cursor: not-allowed; }
.btn-copy-code--copied { background: var(--success); color: #fff; }
.btn-copy-code--copied:hover { background: var(--success); }

.embed-code-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-subtle);
  line-height: 1.5;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--surface-low);
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.footer-status { display: flex; align-items: center; gap: 7px; }

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}
