/* EstatePulse AI - Modern Architectural Luxury Stylesheet */
/* Inspired by Compass, Architectural Digest & Sotheby's */
/* Platform Attribution: K&V Systems (https://kv-systems.web.app) */

/* Warm Premium Light (Default) & Warm Obsidian Dark Theme Variables */
:root {
  --bg: #FBF8F3;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F6F1E9;
  --bg-subtle: #F4EFE6;
  --bg-input: #FFFFFF;
  --border: #E7DFD3;
  --border-active: #9A6B32;
  --text: #1C1917;
  --text-muted: #57534E;
  --text-dim: #78716C;
  --primary: #9A6B32;
  --primary-hover: #7C5322;
  --primary-glow: rgba(154, 107, 50, 0.12);
  --accent: #B45309;
  --accent-bg: rgba(180, 83, 9, 0.12);
  --accent-glow: rgba(180, 83, 9, 0.14);
  --success: #15803D;
  --success-bg: rgba(21, 128, 61, 0.1);
  --warning: #B45309;
  --warning-bg: rgba(180, 83, 9, 0.1);
  --danger: #B91C1C;
  --danger-bg: rgba(185, 28, 28, 0.1);
  --hot: #B91C1C;
  --hot-bg: rgba(185, 28, 28, 0.1);
  --warm: #B45309;
  --warm-bg: rgba(180, 83, 9, 0.1);
  --sidebar-w: 264px;
  --header-h: 64px;
  --bottom-nav-h: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-sm: 0 2px 8px rgba(28, 25, 23, 0.05), 0 1px 2px rgba(28, 25, 23, 0.03);
  --shadow-md: 0 10px 26px rgba(28, 25, 23, 0.07);
  --shadow-lg: 0 22px 46px rgba(28, 25, 23, 0.12);
}

[data-theme="dark"] {
  --bg: #141210;
  --bg-card: #1D1A17;
  --bg-card-hover: #27231F;
  --bg-subtle: #26221E;
  --bg-input: #171412;
  --border: rgba(214, 199, 178, 0.16);
  --border-active: #D4A359;
  --text: #FAF7F2;
  --text-muted: #BDB5AA;
  --text-dim: #8C8378;
  --primary: #D4A359;
  --primary-hover: #E2B773;
  --primary-glow: rgba(212, 163, 89, 0.18);
  --accent: #E07A5F;
  --accent-bg: rgba(224, 122, 95, 0.14);
  --accent-glow: rgba(224, 122, 95, 0.16);
  --success: #34D399;
  --success-bg: rgba(52, 211, 153, 0.14);
  --warning: #FBBF24;
  --warning-bg: rgba(251, 191, 36, 0.14);
  --danger: #F87171;
  --danger-bg: rgba(248, 113, 113, 0.14);
  --hot: #F87171;
  --hot-bg: rgba(248, 113, 113, 0.14);
  --warm: #FBBF24;
  --warm-bg: rgba(251, 191, 36, 0.14);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.48);
  --shadow-lg: 0 24px 54px rgba(0, 0, 0, 0.68);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  user-select: auto;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(28, 25, 23, 0.16);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(28, 25, 23, 0.3);
}

/* App Container Layout */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}

/* Collapsible Left Sidebar (Desktop / Tablet) */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s ease;
}

.sidebar-header {
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--primary);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.brand-badge svg {
  flex-shrink: 0;
}

.brand-tag {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--accent-bg);
  color: #8A6936;
  border: 1px solid rgba(176, 141, 87, 0.35);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.18s ease;
  position: relative;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-glow);
  font-weight: 700;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

.nav-item.active .badge {
  background: var(--primary);
  color: #FFFFFF;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* User & Role Switcher inside Sidebar */
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-pill:hover {
  background: var(--bg-card-hover);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9A6B32, #B88442);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #FFFFFF;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.user-role {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Top App Header */
.top-header {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

@media (max-width: 768px) {
  .top-header {
    padding: 0 12px;
    gap: 8px;
  }
  .header-left > div {
    display: none;
  }
  .demo-badge > span {
    display: none;
  }
  .demo-badge {
    padding: 3px 8px;
    gap: 4px;
  }
  .demo-profile-select {
    max-width: 125px;
    font-size: 11px;
    padding: 3px 4px;
  }
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Network & Sync Badge */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.sync-badge.online {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(21, 128, 61, 0.22);
}

.sync-badge.offline {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.25);
}

.sync-badge.local-only {
  background: var(--accent-bg);
  color: #8A6936;
  border-color: rgba(176, 141, 87, 0.35);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Live Demo Mode Banner & Switcher */
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-bg);
  border: 1px solid rgba(176, 141, 87, 0.35);
  color: #7D5D2E;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.demo-profile-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

/* View Content Canvas */
.view-container {
  flex: 1;
  padding: 28px 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Page Headers & Toolbars */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: #C8C1B6;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(154, 107, 50, 0.22);
}

.btn.primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(154, 107, 50, 0.3);
}

.btn.accent {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.btn.success {
  background: var(--success);
  color: #FFFFFF;
  border-color: var(--success);
}

.btn.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.3);
}

.btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFFFFF;
}

.btn.sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn.lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

.btn.icon-only {
  padding: 8px;
  border-radius: var(--radius-md);
}

/* Cards & Grid Containers */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: #D2CBC0;
  box-shadow: var(--shadow-md);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  color: var(--primary);
  flex-shrink: 0;
}

.stat-icon.emerald {
  background: var(--success-bg);
  color: var(--success);
}
.stat-icon.amber {
  background: var(--accent-bg);
  color: #8A6936;
}
.stat-icon.rose {
  background: var(--hot-bg);
  color: var(--hot);
}
.stat-icon.indigo {
  background: var(--primary-glow);
  color: var(--primary);
}

.stat-val {
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
}

/* Lead Intake Wizard & Funnel */
.wizard-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 840px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  text-align: center;
  cursor: pointer;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 2px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  transition: all 0.2s ease;
}

.wizard-step.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(154, 107, 50, 0.25);
}

.wizard-step.done .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.step-title {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.wizard-step.active .step-title {
  color: var(--primary);
  font-weight: 700;
}

/* Option Selector Tiles */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.option-tile {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text);
}

.option-tile:hover {
  background: var(--bg-card-hover);
  border-color: #C8C1B6;
  transform: translateY(-2px);
}

.option-tile.selected {
  border-color: var(--primary);
  background: var(--primary-glow);
  box-shadow: 0 4px 12px rgba(154, 107, 50, 0.12);
}

.option-tile svg {
  color: var(--primary);
}

.option-tile b {
  font-size: 14px;
}

.option-tile span {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* AI Lead Scoring Pill */
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.score-pill.hot {
  background: var(--hot-bg);
  color: var(--hot);
  border: 1px solid rgba(185, 28, 28, 0.25);
}

.score-pill.warm {
  background: var(--accent-bg);
  color: #8A6936;
  border: 1px solid rgba(176, 141, 87, 0.35);
}

.score-pill.nurture {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(154, 107, 50, 0.25);
}

/* CRM Pipeline Kanban Board */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 220px);
}

.kanban-col {
  width: 320px;
  min-width: 300px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-col-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.lead-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Properties Grid & Card */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.property-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.property-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.property-thumb {
  height: 215px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.property-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  border: 1px solid var(--border);
}

.property-price {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(28, 25, 23, 0.88);
  backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: #FFFFFF;
}

.property-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.property-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Modal and History API Back-button Support */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}

.modal-sheet {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Toast Notifications */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* NutriStudio & K&V Systems Official Brand Footer (Rule 4) */
.kv-brand-footer {
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.kv-brand-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kv-brand-name {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.kv-brand-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.15s ease;
}

.kv-brand-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.kv-sep {
  opacity: 0.35;
}

/* K&V Back to Website Pill Button (Rule 4) */
.kv-back-to-website-btn {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 999980;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 9999px;
  background: rgba(154, 107, 50, 0.86);
  color: #ffffff !important;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none !important;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 10px rgba(154, 107, 50, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0.86;
  transition: all 0.18s ease;
  cursor: pointer;
  user-select: none;
}
.kv-back-to-website-btn:hover {
  opacity: 1;
  background: var(--primary-hover);
  color: #ffffff !important;
  transform: translateY(-1px);
}
.kv-back-to-website-btn svg { flex-shrink: 0; }

/* Mobile Responsive Bottom Navigation Bar (Rule 6) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  flex: 1;
  height: 100%;
  transition: color 0.15s ease;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}

/* Media Queries */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .bottom-nav {
    display: flex;
  }
  .main-wrapper {
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }
  .kv-back-to-website-btn {
    bottom: 70px;
    right: 10px;
    padding: 4px 8px;
    font-size: 10px;
  }
}
