:root {
  --app-font-body: "Space Grotesk", "Segoe UI", sans-serif;
  --app-font-heading: "Fraunces", Georgia, serif;
  --app-radius-lg: 1.2rem;
  --app-radius-md: 0.85rem;
  --app-shadow-soft: 0 12px 28px rgba(15, 23, 42, 0.14);
}

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html[data-bs-theme="light"] {
  --app-bg: radial-gradient(120% 120% at 0% 0%, #f2f7ff 0%, #f9fbff 40%, #fff9f1 100%);
  --app-surface: rgba(255, 255, 255, 0.82);
  --app-surface-strong: #ffffff;
  --app-border: rgba(15, 23, 42, 0.12);
  --app-text: #132033;
  --app-muted: #5e6d83;
  --app-primary: #2f6df6;
  --app-primary-strong: #194ec9;
  --app-success-soft: #ddfbe8;
  --app-danger-soft: #ffe4e3;
}

html[data-bs-theme="dark"] {
  --app-bg: radial-gradient(130% 140% at 0% 0%, #101828 0%, #121c33 46%, #1f142f 100%);
  --app-surface: rgba(15, 23, 42, 0.8);
  --app-surface-strong: #13203b;
  --app-border: rgba(148, 163, 184, 0.28);
  --app-text: #e7edf8;
  --app-muted: #b4c1d7;
  --app-primary: #79a8ff;
  --app-primary-strong: #b7ccff;
  --app-success-soft: rgba(29, 138, 84, 0.25);
  --app-danger-soft: rgba(155, 37, 55, 0.28);
  --app-shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.34);
}

body {
  margin-bottom: 60px;
  font-family: var(--app-font-body);
  color: var(--app-text);
  background: var(--app-bg);
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
  font-family: var(--app-font-heading);
  letter-spacing: 0.01em;
}

a {
  color: var(--app-primary);
}

a:hover {
  color: var(--app-primary-strong);
}

.app-navbar {
  border-bottom: 1px solid var(--app-border);
  backdrop-filter: blur(10px);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-soft);
}

.app-navbar .nav-link,
.app-navbar .navbar-brand,
.app-user-name {
  color: var(--app-text);
}

.app-navbar .nav-link:hover,
.app-navbar .navbar-brand:hover {
  color: var(--app-primary);
}

.theme-switcher-toggle {
  border-radius: 999px;
}

.dropdown-menu {
  border-radius: var(--app-radius-md);
}

.dropdown-item.active,
.dropdown-item:active {
  background-color: var(--app-primary);
  color: #fff;
}

.app-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  line-height: 60px;
  border-top: 1px solid var(--app-border);
  background: transparent;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.18rem rgba(47, 109, 246, 0.26);
}

.form-control,
.form-select {
  border-radius: 0.75rem;
  border-color: var(--app-border);
  background-color: var(--app-surface-strong);
  color: var(--app-text);
}

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

.btn-primary:hover,
.btn-primary:focus-visible,
.btn-primary:active {
  background-color: var(--app-primary-strong);
  border-color: var(--app-primary-strong);
}

.listings-shell {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.listings-hero {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: linear-gradient(115deg, var(--app-surface-strong) 0%, var(--app-surface) 100%);
  box-shadow: var(--app-shadow-soft);
  padding: 1.4rem 1.5rem;
}

.listings-hero h1 {
  margin-bottom: 0.35rem;
}

.listings-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--app-muted);
  margin-bottom: 0.3rem;
}

.listings-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 1rem;
  align-items: start;
}

.listings-sidebar {
  position: sticky;
  top: 1rem;
}

.listings-panel {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-soft);
}

.listings-filters {
  padding: 1rem;
}

.listings-filters .form-label {
  font-weight: 600;
}

.filter-grid {
  display: grid;
  gap: 0.75rem;
}

.listings-content {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.listings-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 0.9rem;
}

.listing-card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-soft);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.listing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.listing-card-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.listing-card-subtitle {
  color: var(--app-muted);
  margin-bottom: 0;
}

.listing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.metric-chip {
  border: 1px solid var(--app-border);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  color: var(--app-muted);
}

.listing-price {
  display: grid;
  gap: 0.35rem;
}

.listing-price-main {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
}

.listing-reference {
  color: var(--app-muted);
}

.listing-deltas {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.delta-pill {
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.delta-good {
  background: var(--app-success-soft);
  color: #139157;
}

.delta-bad {
  background: var(--app-danger-soft);
  color: #d0344e;
}

.delta-neutral {
  background: rgba(117, 134, 161, 0.18);
  color: var(--app-muted);
}

.listing-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.listing-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.listing-actions form {
  margin: 0;
}

.empty-state {
  border: 1px dashed var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  padding: 2.2rem 1rem;
  text-align: center;
  box-shadow: var(--app-shadow-soft);
}

.empty-state i {
  font-size: 2.6rem;
  color: var(--app-muted);
  margin-bottom: 0.7rem;
}

.page-controls {
  display: flex;
  justify-content: space-between;
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
}

.auth-card {
  width: min(100%, 480px);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-soft);
  padding: 1.4rem;
}

.auth-kicker {
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--app-muted);
}

.auth-form .form-label {
  font-weight: 600;
}

.auth-divider {
  margin-top: 0.35rem;
  text-align: center;
  font-size: 0.83rem;
  color: var(--app-muted);
}

@media (max-width: 992px) {
  .listings-layout {
    grid-template-columns: 1fr;
  }

  .listings-sidebar {
    position: static;
  }
}

@media (max-width: 576px) {
  .listing-actions {
    grid-template-columns: 1fr;
  }

  .listings-hero,
  .listings-filters,
  .listing-card {
    padding: 0.9rem;
  }
}