:root {
  --color-primary: #1f6b5c;
  --color-primary-dark: #174f44;
  --color-accent: #c9a227;
  --color-danger: #c0392b;
  --color-surface: #ffffff;
  --color-bg: #f4f7f6;
  --color-text: #1f2933;
  --color-muted: #6b7c86;
  --page-max-width: 1140px;
  --spacing-page-top: 72px;
  --radius-card: 12px;
  --shadow-card: 0 8px 24px rgba(31, 41, 51, 0.08);
  --bottom-nav-height: 64px;
}

body.app-body {
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-bg);
}

body.has-bottom-nav {
  padding-bottom: calc(var(--bottom-nav-height) + 1rem);
}

.nav-spacer {
  height: var(--spacing-page-top);
}

.page-container {
  max-width: var(--page-max-width);
}

.page-title,
h1.page-title,
h2.page-title {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 700;
  font-size: clamp(1.625rem, 3.5vw, 2.125rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--color-text);
  margin-bottom: 0;
}

.page-title::after {
  content: '';
  display: block;
  width: 2.75rem;
  height: 3px;
  margin-top: 0.625rem;
  background: linear-gradient(90deg, var(--color-primary) 0%, rgba(31, 107, 92, 0.25) 100%);
  border-radius: 999px;
}

.page-title.text-center::after {
  margin-left: auto;
  margin-right: auto;
}

.page-subtitle {
  color: var(--color-muted);
  font-size: 1rem;
  line-height: 1.5;
  margin: 0.5rem 0 0;
  max-width: 40rem;
}

.page-header,
.container.page-container > .page-header-text,
.container.page-container > .d-flex:has(.page-title) {
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem !important;
  border-bottom: 1px solid rgba(31, 41, 51, 0.08);
}

.container.page-container > .d-flex:has(.page-title) {
  margin-bottom: 1.75rem !important;
}

.container.page-container > h1.page-title,
.container.page-container > h2.page-title {
  padding-bottom: 1rem;
  margin-bottom: 1.75rem !important;
  border-bottom: 1px solid rgba(31, 41, 51, 0.08);
}

.page-breadcrumb .breadcrumb-item {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-breadcrumb .breadcrumb-item a {
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.page-breadcrumb .breadcrumb-item a:hover {
  color: var(--color-primary);
}

.page-breadcrumb .breadcrumb-item.active {
  color: var(--color-primary-dark);
}

.page-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(31, 41, 51, 0.25);
}

h2, h3.card-title {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.login-box .page-title {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.app-navbar {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(31, 107, 92, 0.12);
  box-shadow: 0 2px 12px rgba(31, 41, 51, 0.06);
}

.navbar-brand {
  font-family: 'Courgette', cursive;
  color: var(--color-primary-dark) !important;
}

.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn-outline-primary {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline-primary:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.app-card,
.card.app-card {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: var(--color-surface);
}

.app-card .card-header {
  background: transparent;
  border-bottom: 1px solid rgba(31, 41, 51, 0.08);
  font-weight: 600;
}

.action-toolbar {
  gap: 0.5rem;
}

.action-toolbar .btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-toolbar .btn i {
  line-height: 1;
}

.visibility-active { color: var(--color-primary); }
.visibility-inactive { color: #adb5bd; }

.table-scroll {
  display: block;
  max-height: 620px;
  width: 100%;
  overflow: auto;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.table-scroll th {
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.person-card {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 1rem;
  background: var(--color-surface);
}

.person-card .card-body {
  padding: 1rem 1.1rem;
}

.person-card-meta {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.empty-state i {
  font-size: 2.5rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.search-panel {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1rem;
}

.tree-viewport {
  width: 100%;
  height: 70vh;
  min-height: 400px;
  border: 1px solid rgba(31, 107, 92, 0.16);
  border-radius: var(--radius-card);
  background:
    radial-gradient(circle at 12% 18%, rgba(219, 39, 119, 0.08), transparent 34%),
    radial-gradient(circle at 88% 12%, rgba(15, 118, 110, 0.1), transparent 32%),
    radial-gradient(circle at 50% 100%, rgba(201, 162, 39, 0.1), transparent 40%),
    linear-gradient(165deg, #f7fcfa 0%, #faf7ef 48%, #f9f4fb 100%);
  box-shadow: var(--shadow-card);
}

.tree-viewport-fullscreen {
  position: fixed;
  inset: var(--spacing-page-top) 0 var(--bottom-nav-height) 0;
  z-index: 1040;
  height: auto;
  border-radius: 0;
}

.tree-help {
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: 0.5rem;
}

.stats-map {
  width: 100%;
  height: 480px;
  min-height: 320px;
}

.login-box {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  border: none;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.login-page {
  background-image: linear-gradient(rgba(31, 107, 92, 0.45), rgba(31, 41, 51, 0.55)), url(https://ourfamily-nameplates.s3-ap-southeast-2.amazonaws.com/public/images/familytree.jpg);
  background-size: cover;
  background-position: center;
}

.auth-home-link {
  display: block;
  text-align: center;
  margin-bottom: 1rem;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bottom-nav-height);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(31, 107, 92, 0.12);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1030;
  padding: 0 0.25rem;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.72rem;
  min-width: 56px;
  min-height: 44px;
}

.bottom-nav-item i {
  font-size: 1.2rem;
  margin-bottom: 0.15rem;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--color-primary);
}

.bottom-nav-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff !important;
  margin-top: -18px;
  box-shadow: 0 8px 20px rgba(31, 107, 92, 0.35);
}

.bottom-nav-fab i {
  font-size: 1.5rem;
  margin: 0;
}

.fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 10px 24px rgba(31, 107, 92, 0.35);
  z-index: 1020;
  text-decoration: none;
}

.fab:hover {
  color: #fff;
  background: var(--color-primary-dark);
}

.toast-stack {
  z-index: 1080;
}

#mynetwork {
  width: 100%;
  height: 100%;
}

.tree-viewport .vis-network:focus {
  outline: none;
}

.landing-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.landing-brand {
  font-family: 'Courgette', cursive;
  font-size: 2.5rem;
}

.dropzone {
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-card);
  background-color: white;
  min-height: 150px;
  padding: 2rem;
}

.dropzone.dz-clickable { cursor: pointer; }

.dz-button {
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background-color: #e8ecef; border-radius: 100px; }
::-webkit-scrollbar-thumb { background-color: var(--color-primary); border-radius: 100px; }

@media (max-width: 991.98px) {
  .desktop-toolbar { display: none !important; }
}

@media (min-width: 992px) {
  body.has-bottom-nav { padding-bottom: 0; }
}

@media (max-width: 767.98px) {
  .login-box { margin: 1rem; }
}
