/* =====================================================================
   LAYOUT  ·  app frame: banner, header, navigation, content area
   Phone first. The navigation is a bottom bar on phones and becomes a
   side rail from 1024px wide.
   ===================================================================== */

/* === SECTION: DEMO BANNER === */
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-4);
  background: var(--accent);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.3;
}
@media (max-width: 479px) { .demo-banner { justify-content: space-between; text-align: left; } }
.demo-banner button {
  flex: none;
  white-space: nowrap;
  border: 0;
  background: rgba(12, 46, 48, 0.14);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--fs-xs);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}
.demo-banner button:hover { background: rgba(12, 46, 48, 0.24); }
/* === /SECTION: DEMO BANNER === */

/* === SECTION: APP HEADER === */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  padding-left: max(var(--sp-4), env(safe-area-inset-left));
  padding-right: max(var(--sp-4), env(safe-area-inset-right));
  background: rgba(12, 46, 48, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
  color: var(--white);
}
.brand:hover { color: var(--white); }
.brand-logo { height: var(--logo-height, 34px); width: auto; max-width: 180px; object-fit: contain; }
.brand-logo-plate { background: var(--cream); padding: 4px 10px; border-radius: 10px; box-sizing: content-box; }
/* Recolour a dark logo: every visible pixel becomes off-white or grey. */
.brand-logo-light { filter: brightness(0) invert(1) sepia(.15) brightness(.97); }
.brand-logo-grey { filter: brightness(0) invert(.74); }
.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.brand-divider {
  width: 1px;
  height: 26px;
  background: var(--line);
}
.brand-by {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.brand-by .simplia-mark { width: 20px; height: 20px; }
.header-spacer { flex: 1; }
.header-tools { display: flex; align-items: center; gap: var(--sp-2); }

@media (max-width: 479px) {
  .brand-by-label { display: none; }
}
/* === /SECTION: APP HEADER === */

/* === SECTION: APP BODY AND NAVIGATION === */
html {
  scroll-padding-top: calc(var(--header-h) + 12px);
  scroll-padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
}
.app-body {
  display: block;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.app-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 54, 56, 0.97);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.nav-item {
  flex: 1;
  min-width: 0;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  position: relative;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item:hover { color: var(--cream); }
.nav-item[aria-current="page"] { color: var(--accent); }
.nav-item .nav-count {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
}
.nav-section-label { display: none; }
@media (max-width: 400px) {
  .nav-item { font-size: 10px; padding: 6px 2px; letter-spacing: -0.01em; }
}

.app-main {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) var(--sp-7);
  padding-left: max(var(--sp-4), env(safe-area-inset-left));
  padding-right: max(var(--sp-4), env(safe-area-inset-right));
}
.app-main:focus { outline: none; }

@media (min-width: 1024px) {
  html { scroll-padding-bottom: 12px; }
  .app-body {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    padding-bottom: 0;
  }
  .app-nav {
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    padding: var(--sp-5) var(--sp-3);
    background: var(--bg);
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .nav-section-label {
    display: block;
    padding: var(--sp-4) var(--sp-3) var(--sp-2);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .nav-item {
    flex: none;
    max-width: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--sp-3);
    padding: 10px var(--sp-3);
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
  }
  .nav-item svg { width: 20px; height: 20px; }
  .nav-item:hover { background: var(--bg-alt); }
  .nav-item[aria-current="page"] { background: var(--circle); color: var(--white); }
  .nav-item[aria-current="page"] svg { color: var(--accent); }
  .nav-item .nav-count { position: static; margin-left: auto; }
  .app-main { padding: var(--sp-6) var(--sp-6) var(--sp-7); }
}
/* === /SECTION: APP BODY AND NAVIGATION === */

/* === SECTION: SIGN-IN FRAME === */
.signin-wrap {
  min-height: calc(100dvh - 30px);
  display: grid;
  place-items: center;
  padding: var(--sp-6) var(--sp-4);
}
.signin-card {
  width: 100%;
  max-width: 460px;
}
/* === /SECTION: SIGN-IN FRAME === */

/* === SECTION: PAGE FOOTER === */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-7);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-xs);
}
/* === /SECTION: PAGE FOOTER === */
