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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.7;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  min-height: 100vh;
  padding-bottom: 76px;
}

body.has-top-nav {
  padding-bottom: 0;
  padding-top: 64px;
}

a {
  text-decoration: none;
  color: inherit;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ===== BOTTOM NAVIGATION ===== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 76px;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 0;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 0;
  max-width: 20%;
  padding: 0.35rem 0.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  color: var(--text-secondary);
  -webkit-user-select: none;
  user-select: none;
  min-width: 56px;
  min-height: 56px;
  position: relative;
}

.bottom-nav-item:hover {
  background: var(--surface-hover);
}

.bottom-nav-item.active {
  color: var(--bmw-blue);
}

.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--bmw-blue);
  border-radius: 0 0 4px 4px;
}

.bottom-nav-item .material-symbols-outlined {
  font-size: 1.5rem;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  transition: all var(--transition-fast);
}

.bottom-nav-item.active .material-symbols-outlined {
  color: var(--bmw-blue);
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.bottom-nav-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

.bottom-nav-item.active .bottom-nav-label {
  color: var(--bmw-blue);
  font-weight: 600;
}

/* ===== TOP NAVIGATION ===== */

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 0 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.top-nav-inner {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.top-nav-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  color: var(--text-secondary);
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 500;
  min-height: 44px;
}

.top-nav-item:hover {
  background: var(--surface-hover);
}

.top-nav-item.active {
  color: var(--bmw-blue);
  background: rgba(0, 102, 177, 0.08);
  font-weight: 600;
}

.top-nav-item .material-symbols-outlined {
  font-size: 1.3rem;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  color: var(--icon-color);
}

.top-nav-item.active .material-symbols-outlined {
  color: var(--bmw-blue);
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

.top-nav-item.logout-item {
  margin-left: auto;
  color: var(--bmw-red);
}

.top-nav-item.logout-item:hover {
  background: rgba(227, 28, 35, 0.08);
}

/* ===== PAGE CONTENT AREA ===== */

.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Hide scrollbar globally */
::-webkit-scrollbar {
  display: none;
}

html {
  scrollbar-width: none;
}

body {
  -ms-overflow-style: none;
}

/* ===== RESPONSIVE ===== */

@media (min-width: 768px) {
  body {
    padding-bottom: 0;
    padding-top: 64px;
  }

  .bottom-nav {
    display: none;
  }

  .top-nav {
    display: flex;
  }

  .app-container {
    padding: 2rem 1.5rem;
  }

  .page-content {
    padding: 2rem 1.5rem;
  }

  .hero-section .hero-content {
    padding: 3rem 2rem 4.5rem;
  }

  .hero-section-home .hero-content {
    padding: 3rem 2rem 6rem;
  }

  .modal-content {
    padding: 2.5rem;
    width: 90%;
    max-width: 480px;
  }

  .modal-wide {
    max-width: 1100px;
  }

  .modal-medium {
    max-width: 800px;
  }
}

@media (max-width: 767px) {
  body {
    padding-bottom: 76px;
    padding-top: 0;
  }

  body.has-top-nav {
    padding-bottom: 76px;
    padding-top: 0;
  }

  .top-nav {
    display: none;
  }

  .bottom-nav {
    display: flex;
  }

  .app-container {
    padding: 1rem 0.75rem;
  }

  .page-content {
    padding: 1rem 0.75rem;
  }

  .hero-section .hero-content {
    padding: 0.75rem 1rem 1rem;
    min-height: 125px;
    gap: 0;
  }

  .hero-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .hero-page-name:only-child {
    margin-top: auto;
    margin-bottom: auto;
  }

  .hero-section-home .hero-content {
    flex-wrap: wrap;
    flex-direction: row;
    padding: 1rem 1rem 2rem;
    min-height: auto;
    gap: 0;
  }

  .hero-section-home .hero-text {
    flex: 0 0 35%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .hero-section-home .hero-model-name {
    flex: 0 0 100%;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.6rem;
  }

  .hero-section-home .hero-text .hero-vehicle-data {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-section-home .hero-image {
    flex: 0 0 65%;
    width: auto;
    height: 185px;
    background-position: center;
  }

  .hero-total {
    font-size: 1.35rem;
  }

  .modal-content {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 92vh;
    margin: 0;
    padding: 1.5rem 1rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: slideUp var(--transition-spring);
  }

  .modal-wide,
  .modal-medium {
    padding: 1.25rem 0.75rem;
  }

  .modal h2 {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
  }

  .modal-split-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .modal-image-container {
    height: 200px;
  }

  .modal-content form [class*="flex-row"],
  .modal-content form div[style*="display: flex"] {
    flex-direction: column;
    gap: 0;
  }

  .modal-content form [class*="flex-row"] > .form-group,
  .modal-content form div[style*="display: flex"] > .form-group {
    width: 100%;
    flex: none;
  }

  .note-viewer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 1.5rem;
  }

  .intervento-card-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .spesa-card {
    padding: 0.75rem 1rem;
  }

  .spesa-card-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  .spesa-card-desc {
    white-space: normal;
  }

  .hover-stack > *:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  * {
    -webkit-tap-highlight-color: transparent;
  }
}

@media (min-width: 1024px) {
  .app-container {
    padding: 2.5rem 2rem;
  }

  .page-content {
    padding: 2.5rem 2rem;
  }

  .grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .grid-3-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .grid-4-cols {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }
}

/* ===== Hero icon buttons (PDF, Reset, etc.) ===== */

.hero-icon-btn {
  position: absolute;
  bottom: 1.5rem;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.hero-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.hero-icon-btn .material-symbols-outlined {
  color: inherit;
}

.hero-pdf-btn {
  right: 1.5rem;
}

.hero-reset-btn {
  left: 1.5rem;
}

@media (max-width: 767px) {
  .hero-icon-btn {
    bottom: 0.75rem;
    width: 36px;
    height: 36px;
  }

  .hero-pdf-btn {
    right: 0.75rem;
  }

  .hero-reset-btn {
    left: 0.75rem;
  }
}
