/* ============================================================
   SEWORL FIX IT — GLOBAL STYLES
   Bold Industrial: Charcoal · Burnt Orange · Concrete White
   Improved Font Hierarchy & Mobile Optimization
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  --black:    #111111;
  --charcoal: #1e1e1e;
  --steel:    #2d2d2d;
  --iron:     #3d3d3d;
  --smoke:    #6b6b6b;
  --silver:   #a8a8a8;
  --concrete: #e8e4df;
  --white:    #f5f3f0;
  --orange:   #e85d04;
  --orange2:  #f48c06;
  --orangeD:  #9d2d00;
  --shadow:   rgba(0,0,0,0.45);
  --ff-head:  'Montserrat', sans-serif;
  --ff-cond:  'Montserrat', sans-serif;
  --ff-body:  'Inter', sans-serif;
  --radius:   4px;
  --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Reset & Base Typography ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }

/* Respect users who request reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Don't show outline on mouse clicks (we still keep :focus-visible above) */
:focus:not(:focus-visible) { outline: none; }

/* Screen-reader-only utility */
.sr-only {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0,0,0,0) !important;
  white-space: nowrap !important; border: 0 !important;
}

/* Skip-to-content link — visible only when focused */
.skip-link {
  position: absolute;
  top: -100px; left: 12px;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--orange); color: white;
  font-family: var(--ff-cond); font-weight: 700;
  font-size: 0.88rem; letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

body {
  font-family: var(--ff-body);
  font-weight: 400;
  font-size: 16px;
  background: var(--white);
  color: var(--steel);
  overflow-x: hidden;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; }

/* ── Typography Improvements ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-head);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--charcoal);
}

h1 {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  letter-spacing: -0.025em;
}

h3 {
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h4 {
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-family: var(--ff-cond);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

p, li, .p-text {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--steel);
}

/* Small text */
small, .text-small {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--smoke);
}

/* ── Utility ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.section-label {
  font-family: var(--ff-cond);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.section-label::before {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  background: var(--orange);
}

.section-title {
  font-family: var(--ff-head);
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--charcoal);
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.section-title span { color: var(--orange); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-family: var(--ff-cond);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
}
.btn-primary {
  background: var(--orange);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--orangeD);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232,93,4,0.35);
}
.btn-outline {
  border: 2px solid var(--white);
  color: var(--white);
  background: transparent;
}
.btn-outline:hover {
  background: var(--white);
  color: var(--charcoal);
}
.btn-dark {
  border: 2px solid var(--charcoal);
  color: var(--charcoal);
  background: transparent;
}
.btn-dark:hover {
  background: var(--charcoal);
  color: var(--white);
}

/* ── Contact Bar ── */
.contact-bar {
  background: var(--black);
  padding: 10px 0;
  border-bottom: 2px solid var(--orange);
}
.contact-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.contact-bar-items {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.contact-bar-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--ff-cond);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--silver);
}
.contact-bar-item svg { color: var(--orange); flex-shrink: 0; }
.contact-bar-item a { color: var(--silver); transition: color 0.2s; }
.contact-bar-item a:hover { color: var(--orange); }
.cb-right { display: flex; align-items: center; gap: 14px; }
.cb-hours {
  font-family: var(--ff-cond);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--silver);
  letter-spacing: 0.05em;
}
.cb-portal-btn {
  padding: 6px 16px;
  background: var(--orange);
  color: var(--white);
  font-family: var(--ff-cond);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: var(--transition);
}
.cb-portal-btn:hover { background: var(--orangeD); }

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--charcoal);
  padding: 0;
  box-shadow: 0 2px 20px var(--shadow);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 16px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  max-width: 240px;
}
.nav-logo-img {
  height: 45px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  display: block;
}
.nav-logo-icon {
  width: 42px;
  height: 42px;
  background: var(--orange);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.nav-logo-text .brand {
  font-family: var(--ff-head);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.nav-logo-text .tagline {
  font-family: var(--ff-cond);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--orange);
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  font-family: var(--ff-cond);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--silver);
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--orange);
  transform: scaleX(0);
  transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: var(--white); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links .nav-cta {
  margin-left: 10px;
  background: var(--orange);
  color: var(--white);
  padding: 9px 20px;
}
.nav-links .nav-cta:hover { background: var(--orangeD); }
.nav-links .nav-cta::after { display: none; }
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  z-index: 1001;
  width: 40px;
  height: 40px;
  transition: var(--transition);
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  transition: all 0.3s ease;
  border-radius: 2px;
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* ── Footer ── */
footer {
  background: var(--black);
  border-top: 3px solid var(--orange);
  padding: 60px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--iron);
}
.footer-brand .brand-name {
  font-family: var(--ff-head);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.02em;
  line-height: 1;
}
.footer-brand .brand-name span { color: var(--orange); }
.footer-brand p {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--smoke);
  margin-top: 12px;
  line-height: 1.7;
}
.footer-socials {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.footer-socials a {
  width: 36px;
  height: 36px;
  background: var(--steel);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--silver);
  transition: var(--transition);
}
.footer-socials a:hover { background: var(--orange); color: var(--white); }
.footer-col h4 {
  font-family: var(--ff-cond);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--iron);
}
.footer-col ul li {
  margin-bottom: 10px;
}
.footer-col ul li a {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--smoke);
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.footer-col ul li a:hover { color: var(--orange); }
.footer-col ul li a::before {
  content: '›';
  color: var(--orange);
  font-weight: bold;
}
.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--smoke);
}
.footer-contact-item svg { color: var(--orange); margin-top: 2px; flex-shrink: 0; }
.footer-bottom {
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-bottom p {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--smoke);
  font-family: var(--ff-cond);
  letter-spacing: 0.05em;
}
.footer-bottom p span { color: var(--orange); }

/* ── Page Hero (inner pages) ── */
.page-hero {
  background: var(--charcoal);
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 40px,
    rgba(232,93,4,0.03) 40px,
    rgba(232,93,4,0.03) 80px
  );
}
.page-hero h1 {
  font-family: var(--ff-head);
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 800;
  color: var(--white);
  line-height: 1.05;
  letter-spacing: -0.03em;
  position: relative;
}
.page-hero h1 span { color: var(--orange); }
.page-hero p {
  color: var(--silver);
  margin-top: 12px;
  font-size: 1.05rem;
  font-weight: 500;
  max-width: 500px;
  position: relative;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-cond);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--smoke);
  margin-bottom: 20px;
  text-transform: uppercase;
  position: relative;
}
.breadcrumb a { color: var(--orange); }
.breadcrumb span { color: var(--iron); }

/* Process Section */
.process-section {
  padding: 80px 0;
  background: var(--charcoal);
}
.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin-top: 48px;
}
.process-card {
  background: var(--steel);
  border-radius: var(--radius);
  padding: 32px 24px;
  position: relative;
  transition: var(--transition);
  border: 1px solid rgba(255,255,255,0.05);
}
.process-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 35px -12px rgba(0,0,0,0.3);
  background: var(--iron);
}
.process-number {
  font-family: var(--ff-head);
  font-size: 3rem;
  font-weight: 700;
  color: var(--orange);
  opacity: 0.45;
  line-height: 1;
  margin-bottom: 16px;
}
.process-icon {
  width: 56px;
  height: 56px;
  background: rgba(232,93,4,0.15);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange);
  margin-bottom: 24px;
}
.process-card h3 {
  font-family: var(--ff-head);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 12px;
}
.process-card p {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--silver);
  line-height: 1.7;
  margin-bottom: 0;
}

/* ============================================================
   RESPONSIVE STYLES (Mobile Optimized)
   ============================================================ */

/* Tablet and mobile navigation */
@media (max-width: 900px) {
  .hamburger {
    display: flex;
  }
  
  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--charcoal);
    flex-direction: column;
    padding: 80px 20px 30px;
    gap: 8px;
    border-left: 3px solid var(--orange);
    box-shadow: -5px 0 30px rgba(0,0,0,0.4);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
  }
  
  .nav-links.open {
    display: flex;
    right: 0;
  }
  
  .nav-links a {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    text-align: left;
    border-radius: var(--radius);
    margin: 0;
  }
  
  .nav-links a::after {
    display: none;
  }
  
  .nav-links a:hover, 
  .nav-links a.active {
    background: rgba(232,93,4,0.2);
    color: var(--orange);
  }
  
  .nav-links .nav-cta {
    background: var(--orange);
    color: var(--white);
    margin: 8px 0;
    text-align: center;
  }
  
  .nav-links .nav-cta.portal-btn {
    background: transparent;
    border: 1px solid var(--orange);
    color: var(--orange);
  }
  
  .nav-links .nav-cta.portal-btn:hover {
    background: var(--orange);
    color: var(--white);
  }
  
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  
  .process-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

/* Mobile logo and typography adjustments */
@media (max-width: 768px) {
  /* Logo sizing */
  .nav-logo {
    max-width: 180px;
  }
  .nav-logo-img {
    height: 35px;
    max-width: 90px;
  }
  .nav-logo-text .brand {
    font-size: 0.9rem;
  }
  .nav-logo-text .tagline {
    font-size: 0.5rem;
  }
  .nav-inner {
    height: 60px;
  }
  
  /* Mobile typography */
  body {
    font-size: 15px;
    line-height: 1.7;
  }
  
  p, li, .p-text {
    font-size: 0.95rem;
    line-height: 1.7;
  }
  
  h1 {
    font-size: 2.2rem;
    letter-spacing: -0.01em;
  }
  
  h2 {
    font-size: 1.8rem;
  }
  
  h3 {
    font-size: 1.3rem;
  }
  
  .section-title {
    font-size: 1.8rem;
    letter-spacing: -0.01em;
  }
  
  /* Contact bar mobile */
  .contact-bar .container {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
  }
  .contact-bar-items {
    justify-content: center;
    gap: 16px;
  }
  .contact-bar-item {
    font-size: 0.7rem;
  }
  .cb-right {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .cb-hours {
    font-size: 0.65rem;
    text-align: center;
  }
  .cb-portal-btn {
    width: 100%;
    text-align: center;
    padding: 8px 16px;
  }
  
  /* Hero mobile */
  .page-hero {
    padding: 60px 0 40px;
  }
  .page-hero h1 {
    font-size: 2rem;
  }
  .page-hero p {
    font-size: 0.9rem;
  }
  
  /* Process section mobile */
  .process-section {
    padding: 60px 0;
  }
  .process-grid {
    gap: 20px;
  }
  .process-card {
    padding: 24px 20px;
  }
  .process-card h3 {
    font-size: 1.2rem;
  }
}

/* Small mobile (under 600px) */
@media (max-width: 600px) {
  .nav-logo {
    max-width: 150px;
  }
  .nav-logo-img {
    height: 30px;
    max-width: 70px;
  }
  .nav-logo-text .brand {
    font-size: 0.75rem;
  }
  .nav-logo-text .tagline {
    font-size: 0.4rem;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
  }
  
  .process-grid {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 0 16px;
  }
  
  .btn {
    padding: 12px 24px;
    font-size: 0.85rem;
  }
}

/* Extra small mobile (under 400px) */
@media (max-width: 400px) {
  .nav-logo {
    max-width: 130px;
  }
  .nav-logo-img {
    height: 25px;
    max-width: 60px;
  }
  .nav-logo-text .brand {
    font-size: 0.7rem;
  }
  .nav-logo-text .tagline {
    font-size: 0.35rem;
  }
  
  body {
    font-size: 14px;
  }
  
  p, li, .p-text {
    font-size: 0.88rem;
  }
}

/* ============================================================
   PORTAL MOBILE MENU — bottom navigation bar (admin only)
   Honors iPhone home-indicator safe-area-inset.
   ============================================================ */
@media (max-width: 900px) {
  .p-sidebar { display: none; }

  /* Leave room for the bottom nav + the iPhone home indicator */
  .p-main {
    margin-bottom: calc(70px + env(safe-area-inset-bottom));
    padding-bottom: 0;
  }

  .p-mobile-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--charcoal);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
    border-top: 2px solid var(--orange);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    overflow-x: auto;            /* scroll if the tabs outgrow the width */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .p-mobile-bottom-nav::-webkit-scrollbar { display: none; }

  .p-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: var(--radius);
    color: var(--silver);
    font-family: var(--ff-cond);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    transition: var(--transition);
    flex: 0 0 auto;
    min-width: 58px;
    min-height: 48px;            /* 48dp touch target */
    text-align: center;
    justify-content: center;
  }

  .p-mobile-nav-item svg {
    width: 20px; height: 20px;
    stroke: currentColor; fill: none; stroke-width: 2;
  }

  .p-mobile-nav-item.active   { color: var(--orange); background: rgba(232,93,4,0.18); }
  .p-mobile-nav-item:hover    { color: var(--orange); background: rgba(232,93,4,0.10); }

  /* Avoid content hiding under the bottom nav */
  .p-project-detail,
  .p-inv-list,
  .p-pd-section,
  .p-inv-builder {
    padding-bottom: 20px;
  }
}

/* Invoice Builder Mobile Fixes */
@media (max-width: 900px) {
  .p-inv-builder {
    padding: 12px !important;
  }
  
  .p-inv-builder-section {
    padding: 12px !important;
    margin: 12px 0 !important;
  }
  
  .p-inv-builder-section-title {
    font-size: 0.85rem !important;
    margin-bottom: 12px !important;
  }
  
  /* Make tables horizontally scrollable */
  .p-inv-materials-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
    padding: 0 8px;
  }
  
  .p-inv-table {
    min-width: 650px;
    font-size: 0.75rem;
  }
  
  .p-inv-table th,
  .p-inv-table td {
    padding: 6px 8px !important;
  }
  
  /* Section cards full width */
  .p-inv-section-card {
    margin: 12px 0 !important;
  }
  
  .p-inv-section-card-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
  }
  
  .p-inv-section-card-header input,
  .p-inv-section-card-header select {
    width: 100% !important;
    min-width: auto !important;
  }
  
  /* Workmanship row */
  .p-inv-workmanship {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .p-inv-workmanship input {
    width: 100% !important;
  }
  
  /* Totals box */
  .p-inv-totals-box {
    font-size: 0.85rem;
  }
  
  .p-inv-totals-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 12px;
  }
  
  .p-inv-totals-row.grand {
    text-align: center;
  }
  
  .p-inv-totals-row.grand strong {
    font-size: 1.2rem;
  }
  
  /* Action buttons */
  .p-inv-builder > div:last-child {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
    padding: 12px !important;
  }
  
  .p-inv-builder > div:last-child button {
    width: 100%;
    justify-content: center;
  }
  
  .p-inv-builder > div:last-child .p-btn {
    width: 100%;
  }
  
  .p-inv-builder > div:last-child div[style*="width:1px"] {
    display: none;
  }
}

/* (Duplicate mobile bottom-nav block removed — consolidated above with safe-area-inset.) */

/* Mobile form inputs — prevent iOS zoom + comfortable touch */
@media (max-width: 768px) {
  input, select, textarea, button {
    font-size: 16px !important;          /* iOS only auto-zooms when font-size < 16px */
  }

  .p-form-group input,
  .p-form-group select,
  .p-form-group textarea {
    padding: 12px 14px !important;
  }

  /* Modal sizing */
  .p-modal-box {
    width: 95% !important;
    margin: 10px auto !important;
    max-height: 90vh !important;
  }
  .p-modal-body { padding: 16px !important; }

  /* Sticky modal close so it's always reachable in long forms */
  .p-modal-header {
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 2;
    box-shadow: 0 1px 0 var(--concrete);
  }

  /* Invoice builder inputs — ≥16px so iOS does NOT zoom on focus */
  .row-input,
  .variant-select,
  .p-inv-cell {
    font-size: 16px !important;
    padding: 9px 8px !important;
  }
  .item-qty { width: 64px !important; }
  .variant-select { min-width: 120px !important; }

  /* Icon-button tap target: 36px square minimum */
  .p-icon-btn { min-width: 36px; min-height: 36px; padding: 7px !important; }

  /* Long parent-name in variant rows should wrap, not blow out the row */
  .p-inv-table .variant-row td:first-child {
    white-space: normal !important;
    word-break: break-word;
    max-width: 12em;
  }

  /* Restore-scroll-on-tab-change isn't possible from CSS — but contain bounce */
  .p-main { overscroll-behavior-y: contain; }
}

/* Sticky save-bar for the invoice builder on mobile — survive long BOQs */
@media (max-width: 900px) {
  .p-inv-builder-actions {
    position: sticky;
    bottom: calc(70px + env(safe-area-inset-bottom));
    background: white;
    box-shadow: 0 -6px 18px rgba(0,0,0,0.08);
    padding: 10px 14px;
    z-index: 50;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid var(--concrete);
  }
  .p-inv-builder-actions .p-btn { flex: 1; min-width: 120px; }
}

/* ============================================================
   GLOBAL MOBILE TOUCH & USABILITY POLISH
   ============================================================ */

/* Better touch targets on all interactive elements */
@media (max-width: 768px) {
  /* Increase tap target size for nav items */
  .nav-links a { min-height: 44px; display: flex; align-items: center; }

  /* Buttons get comfortable touch area */
  .btn { min-height: 44px; }
  .p-btn { min-height: 44px; }

  /* Contact bar — very compact on small screens */
  .contact-bar {
    display: none; /* Hidden on mobile to save space; portal button is in the nav */
  }
  .navbar .nav-links .nav-cta[href="portal.html"] {
    display: flex; /* Ensure portal link visible in mobile menu */
  }

  /* Footer columns tighter padding */
  .footer-grid { gap: 24px; }
  .footer-col h4 { margin-bottom: 12px; }

  /* Footer bottom stacks */
  .footer-bottom { flex-direction: column; text-align: center; }

  /* Breadcrumb smaller */
  .breadcrumb { font-size: 0.72rem; }

  /* Page hero reduced padding */
  .page-hero { padding: 48px 0 32px; }
  .page-hero h1 { font-size: clamp(1.8rem, 7vw, 3rem); }

  /* Process cards in 1 col on small mobile */
  .process-card { padding: 20px 16px; }
}

/* Swipe-friendly horizontal scrollables */
@media (max-width: 768px) {
  .p-phase-track { scroll-snap-type: x mandatory; }
  .p-phase-step  { scroll-snap-align: start; }

  /* Prevent content overflow on all pages */
  .container { padding: 0 14px; }
}

@media (max-width: 480px) {
  /* Very small screens: tighten everything */
  .container { padding: 0 12px; }
  .footer-grid { gap: 20px; }
  section { overflow-x: hidden; }

  /* Nav logo even smaller if needed */
  .nav-inner { height: 56px; }
}

/* ============================================================
   SCROLL REVEAL — subtle fade + rise as sections enter view.
   Hidden state only applies when JS adds `.js-reveal` to <html>,
   so if JS fails or is disabled the page is fully visible.
   Reduced-motion users always see content immediately.
   Only animates transform/opacity (GPU-friendly — safe on phones).
   ============================================================ */
html.js-reveal .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s cubic-bezier(.25,.46,.45,.94),
              transform .6s cubic-bezier(.25,.46,.45,.94);
  will-change: opacity, transform;
}
html.js-reveal .reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  html.js-reveal .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}