/* Shared mobile/tablet layer for all planner pages */

:focus-visible {
  outline: 2px solid #7eb8d4;
  outline-offset: 2px;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  background: #f4f1ef;
}

body {
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
  padding-top: max(0px, env(safe-area-inset-top));
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}

body.shc-has-mobile-nav {
  padding-bottom: calc(88px + max(0px, env(safe-area-inset-bottom))) !important;
}

.shc-topbar {
  position: fixed;
  left: max(0px, env(safe-area-inset-left));
  right: max(0px, env(safe-area-inset-right));
  top: 0;
  z-index: 9000;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 10px;
  align-items: end;
  min-width: 0;
  min-height: 106px;
  padding: calc(env(safe-area-inset-top, 0px) + 4px) 14px 6px;
  background: #f4f1ef;
  border-bottom: 1px solid #ddd3ce;
}

.shc-topbar .menu-toggle {
  grid-column: 1;
  align-self: end;
}

.shc-topbar::after {
  content: "";
  grid-column: 3;
  align-self: end;
  width: 40px;
  height: 40px;
}

.shc-app-title {
  grid-column: 2;
  align-self: end;
  font-family: "Montserrat", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2f2a27;
  line-height: 1.1;
  min-width: 0;
  text-align: center;
  padding-right: 0;
  margin: 0;
}

.shc-mobile-nav {
  position: fixed;
  left: max(0px, env(safe-area-inset-left));
  right: max(0px, env(safe-area-inset-right));
  bottom: 0;
  z-index: 10000;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid #ddd3ce;
  background: #f1ece7;
}

.shc-mobile-nav a {
  text-decoration: none;
  color: #7d726b;
  text-align: center;
  padding: 9px 6px 10px;
  font-size: 12px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  min-height: 84px;
}

.shc-mobile-nav .nav-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
}

.shc-mobile-nav .nav-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shc-mobile-nav a.active {
  background: #8f9786;
  color: #fff;
  border-radius: 0;
  margin: 0;
  padding: 9px 6px 10px;
  font-weight: 600;
}

input,
select,
textarea {
  font-size: 16px; /* Prevent iOS input zoom */
}

button,
.btn,
.back,
.mode-btn {
  min-height: 44px;
}

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
  .page,
  .layout,
  .shell {
    width: 100%;
    max-width: 100%;
  }

  .head,
  .top {
    gap: 10px;
  }

  .head-links,
  .links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .page {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .panel {
    border-radius: 12px;
  }

  .top-strip {
    grid-template-columns: repeat(2, 1fr) !important;
    height: auto !important;
  }

  .top-strip img {
    min-height: 88px;
    max-height: 140px;
    object-fit: cover;
  }
}

@media (max-width: 480px) {
  .page {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  h1 {
    font-size: clamp(30px, 9vw, 42px) !important;
  }

  .head-links,
  .links {
    gap: 6px;
  }

  .back,
  .btn,
  button {
    font-size: 13px;
    padding: 8px 10px;
  }
}
