:root {
  --navy: #12324d;
  --navy-deep: #0e2740;
  --navy-mid: #173d5c;
  --gold: #d4b36a;
  --gold-mid: #c4a35a;
  --gold-dark: #8b6914;
  --cream: #f3f0ea;
  --text: #1c2430;
  --muted: #5d6570;
  --line: #e7e1d6;
  --nav-h: 58px;
  --tab-h: 64px;
  --side-w: 280px;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.app-body {
  margin: 0;
  background: var(--cream);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  overflow-x: hidden;
}

body.sidebar-open {
  overflow: hidden;
}

.app-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 10px 0;
  background: var(--navy-deep);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: visible;
  box-shadow: 0 10px 28px rgba(14, 39, 64, 0.16);
}

.app-navbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, #8b6914, var(--gold), #f3e2b0, var(--gold), #8b6914);
  pointer-events: none;
}

.app-icon-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.08rem;
  line-height: 1;
  text-decoration: none;
  position: relative;
  touch-action: manipulation;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.app-icon-btn.is-menu {
  background: rgba(212, 179, 106, 0.14);
  color: var(--gold);
}

body.sidebar-open .app-icon-btn.is-menu,
body.sidebar-open .app-icon-btn.is-menu:hover,
body.sidebar-open .app-icon-btn.is-menu:focus {
  background: var(--gold);
  color: var(--navy-deep);
}

.app-icon-btn:hover,
.app-icon-btn:focus,
.app-icon-btn:focus-visible {
  background: rgba(212, 179, 106, 0.22);
  color: var(--gold);
  text-decoration: none;
  outline: 0;
}

.app-firm {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff !important;
  text-decoration: none !important;
  line-height: 1.15;
}

.app-firm-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(212, 179, 106, 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(212, 179, 106, 0.18);
}

.app-firm-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
}

.app-firm-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.app-firm-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
}

.app-firm:hover .app-firm-copy strong,
.app-firm:focus .app-firm-copy strong {
  color: var(--gold);
}

.app-nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.app-navbar .dropdown {
  position: relative;
}

.app-nav-actions .dropdown-toggle::after {
  display: none;
}

.app-bell.has-mail {
  color: var(--gold);
}

.app-bell-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: #d64545;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--navy-deep);
}

.app-account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  max-width: 46vw;
  padding: 3px 8px 3px 3px;
  border: 1px solid rgba(212, 179, 106, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app-account:hover,
.app-account:focus {
  background: rgba(212, 179, 106, 0.16);
  border-color: rgba(212, 179, 106, 0.55);
  outline: 0;
}

.app-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  display: block;
  flex-shrink: 0;
}

.app-avatar-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy-deep);
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-account-name {
  display: none;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.app-account-caret {
  display: none;
  font-size: 10px;
  color: var(--gold);
}

.app-navbar .app-drop {
  min-width: 260px;
  max-width: min(340px, calc(100vw - 16px));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(14, 39, 64, 0.18);
  padding: 6px;
  margin-top: 8px;
  background: #fffaf3;
  z-index: 1300;
}

.app-navbar .app-drop.show {
  animation: appDropIn 0.16s ease;
}

@keyframes appDropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.app-drop-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.app-drop-head strong {
  display: block;
  color: var(--navy-deep);
  font-size: 15px;
}

.app-drop-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.app-navbar .dropdown-item.app-drop-note,
.app-navbar .dropdown-item.app-drop-link,
.app-navbar .dropdown-item.app-drop-foot {
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
  white-space: normal;
}

.app-drop-note-title {
  display: block;
  font-weight: 700;
  color: var(--navy-deep);
  font-size: 14px;
}

.app-drop-note-body,
.app-drop-note-time {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.app-drop-note-body {
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-drop-note-time {
  margin-top: 4px;
  color: var(--gold-dark);
}

.app-drop-empty {
  text-align: center;
  padding: 18px 10px;
  color: var(--muted);
}

.app-drop-empty i {
  color: var(--gold);
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.app-drop-empty p {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.app-drop-link i {
  width: 18px;
  color: var(--gold-dark);
  margin-right: 8px;
}

.app-drop-foot {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  font-weight: 700 !important;
  color: var(--navy-deep) !important;
  text-align: center;
}

.app-navbar .dropdown-item:hover,
.app-navbar .dropdown-item:focus {
  background: #f3ead8;
  color: var(--navy-deep);
}

.app-drop-link.is-out {
  color: #9b1c1c !important;
}

.app-drop-link.is-out i {
  color: #9b1c1c;
}

.sidebar-overlay {
  position: fixed;
  top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 18, 30, 0.5);
  z-index: 1080;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#sidebar-wrapper {
  width: min(var(--side-w), 86vw);
  position: fixed;
  top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  left: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  height: auto;
  background: var(--navy-deep);
  color: #fff;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  transform: translate3d(-105%, 0, 0);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.34s;
  box-shadow: 12px 0 32px rgba(0, 0, 0, 0.22);
}

#sidebar-wrapper.active {
  transform: none;
  visibility: visible;
  pointer-events: auto;
}

.lawnexa-brand {
  position: relative;
  flex-shrink: 0;
  background: var(--navy-deep);
  padding: 0.55rem 0.85rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid rgba(212, 179, 106, 0.35);
}

.lawnexa-brand img {
  display: block;
  height: 64px;
  width: auto;
  max-width: 168px;
  margin: 0 auto;
  object-fit: contain;
}

.sidebar-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
  font-size: 1.1rem;
}

.sidebar-close:hover,
.sidebar-close:focus {
  background: rgba(212, 179, 106, 0.2);
  color: #fff;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 10px;
}

.side-label {
  margin: 12px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(212, 179, 106, 0.72);
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin: 2px 0;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #f4f0e8;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  text-decoration: none !important;
  cursor: pointer;
  touch-action: manipulation;
}

.side-link:hover,
.side-link:focus {
  background: var(--navy-mid);
  color: #fff;
  outline: 0;
}

.side-link.is-on {
  background: var(--navy-mid);
  box-shadow: inset 3px 0 0 var(--gold);
  color: #fff;
}

.side-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(212, 179, 106, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.side-ico i {
  color: var(--gold);
  font-size: 13px;
}

.side-link.is-on .side-ico {
  background: var(--gold);
}

.side-link.is-on .side-ico i {
  color: var(--navy-deep);
}

.side-text {
  min-width: 0;
  flex: 1;
}

.side-caret {
  margin-left: auto;
  color: var(--gold);
  font-size: 11px;
  transition: transform 0.28s ease;
}

.side-group.is-open .side-caret {
  transform: rotate(180deg);
}

.side-sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.side-group.is-open .side-sub {
  grid-template-rows: 1fr;
}

.side-sub-inner {
  min-height: 0;
  overflow: hidden;
  margin: 0 6px 6px 14px;
  padding: 4px 0 4px 8px;
  border-left: 2px solid rgba(212, 179, 106, 0.28);
}

.side-link.is-sub {
  min-height: 40px;
  padding: 0 10px 0 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: #dbe4ee;
}

.side-link.is-sub i {
  width: 16px;
  color: var(--gold);
  font-size: 12px;
  text-align: center;
}

.side-link.is-sub.is-on {
  color: #fff;
}

.ml-sidebar {
  margin-left: 0;
}

.app-main {
  min-width: 0;
  width: 100%;
  padding-left: 12px;
  padding-right: 12px;
}

.app-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1110;
  display: flex;
  align-items: stretch;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(14, 39, 64, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(212, 179, 106, 0.38);
  box-shadow: 0 -10px 24px rgba(14, 39, 64, 0.2);
  border-radius: 16px 16px 0 0;
}

.app-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
  border: 0;
  background: transparent;
  color: #d8d0c3;
  font-family: inherit;
  text-decoration: none !important;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app-tab::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 22%;
  right: 22%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-tab-ico {
  width: 36px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.app-tab-ico i {
  font-size: 1.05rem;
  color: var(--gold);
}

.app-tab-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  color: #efe8dc;
}

.app-tab.is-on::before {
  opacity: 1;
  transform: none;
}

.app-tab.is-on .app-tab-ico {
  background: var(--gold);
  transform: translateY(-1px);
}

.app-tab.is-on .app-tab-ico i {
  color: var(--navy-deep);
}

.app-tab.is-on .app-tab-label {
  color: #fff;
}

@media (hover: hover) {
  .app-tab:hover::before {
    opacity: 1;
    transform: none;
  }

  .app-tab:hover .app-tab-ico {
    background: var(--gold);
    transform: translateY(-1px);
  }

  .app-tab:hover .app-tab-ico i {
    color: var(--navy-deep);
  }

  .app-tab:hover .app-tab-label {
    color: #fff;
  }
}

.app-tab:focus {
  outline: 0;
}

.app-tab:focus-visible .app-tab-ico {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--gold);
}

@media (max-width: 767.98px) {
  .app-main {
    padding-bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 768px) {
  #sidebar-wrapper {
    width: var(--side-w);
    transform: none;
    visibility: visible;
    pointer-events: auto;
    bottom: 0;
    height: calc(100dvh - var(--nav-h) - env(safe-area-inset-top, 0px));
  }

  .sidebar-close,
  .sidebar-overlay,
  .app-tabbar {
    display: none !important;
  }

  .ml-sidebar {
    margin-left: var(--side-w);
  }

  .app-navbar {
    padding-left: 16px;
    padding-right: 16px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }

  .app-firm {
    grid-column: 2;
    flex: none;
    justify-self: center;
    max-width: min(28rem, 42vw);
  }

  .app-nav-actions {
    grid-column: 3;
    justify-self: end;
    margin-left: 0;
  }

  .app-firm-copy strong {
    font-size: 16px;
  }

  .app-account {
    padding: 3px 10px 3px 3px;
  }

  .app-account-name {
    display: inline-block;
  }

  .app-account-caret {
    display: inline;
  }

  .app-main {
    padding-left: 20px;
    padding-right: 20px;
  }

  .lawnexa-brand img {
    height: 78px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #sidebar-wrapper,
  .sidebar-overlay,
  .side-sub,
  .side-caret,
  .app-tab::before,
  .app-tab-ico,
  .app-navbar .app-drop.show {
    transition: none;
    animation: none;
  }
}
