/* Property Connect — Operations Portal : application shell (top bar + tree sidebar) */

.pc-shell { min-height: 100vh; display: flex; background: var(--pc-bg); }
.pc-shell__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pc-shell__content {
  flex: 1;
  padding: clamp(20px, 3vw, 32px) clamp(16px, 3vw, 32px) 64px;
}
.pc-shell__inner { max-width: 1360px; margin: 0 auto; }

/* ---------- sidebar ---------- */
.pc-sidebar {
  width: 272px;
  flex: none;
  background: var(--pc-navy);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.pc-sidebar__head {
  padding: 20px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pc-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.pc-brand__mark {
  width: 34px; height: 34px;
  flex: none;
  border-radius: var(--pc-r-md);
  background: var(--pc-green);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: grid;
  place-items: center;
}
.pc-brand__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.pc-brand__name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-brand__sub { color: var(--pc-navy-muted); font-weight: 500; font-size: 11.5px; }

.pc-sidebar__close {
  width: 32px; height: 32px;
  flex: none;
  display: none;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--pc-navy-ink);
  cursor: pointer;
  place-items: center;
}

.pc-module-switch {
  margin: 6px 14px 16px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 28px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--pc-r-lg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.pc-module-switch:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.pc-module-switch__icon {
  width: 26px; height: 26px;
  flex: none;
  border-radius: var(--pc-r-sm);
  background: rgba(61, 181, 74, 0.18);
  color: #6fd37b;
  display: grid;
  place-items: center;
}
.pc-module-switch__text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pc-module-switch__name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-module-switch__hint { color: var(--pc-navy-muted); font-size: 11px; font-weight: 500; }

.pc-tree { flex: 1; overflow-y: auto; padding: 0 14px 20px; }
.pc-tree__group { margin-bottom: 3px; }

.pc-tree__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--pc-r-lg);
  background: transparent;
  color: var(--pc-navy-ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.14s ease;
}
.pc-tree__item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.pc-tree__item::before {
  content: "";
  width: 7px; height: 7px;
  flex: none;
  border-radius: 2px;
  background: #4e5c6b;
}
.pc-tree__item[aria-current="page"] {
  background: var(--pc-green);
  color: #fff;
  font-weight: 600;
}
.pc-tree__item[aria-current="page"]::before { background: rgba(255, 255, 255, 0.75); }
.pc-tree__item--branch-active { color: #fff; font-weight: 600; }
.pc-tree__item--branch-active::before { background: var(--pc-green); }
.pc-tree__label { flex: 1; }
.pc-tree__caret {
  transition: transform 0.2s ease;
  transform: rotate(-90deg);
  opacity: 0.75;
  flex: none;
}
.pc-tree__item[aria-expanded="true"] .pc-tree__caret { transform: rotate(0deg); }

.pc-tree__children {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.26s ease, opacity 0.2s ease;
}
.pc-tree__children[data-open="true"] { opacity: 1; }
.pc-tree__children-inner {
  margin: 4px 0 8px 20px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pc-tree__child {
  display: block;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-radius: var(--pc-r-md);
  background: transparent;
  color: #9ba7b4;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}
.pc-tree__child:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.pc-tree__child[aria-current="page"] {
  background: rgba(61, 181, 74, 0.16);
  color: #8fe39b;
  font-weight: 700;
}
.pc-tree__child[aria-disabled="true"],
.pc-tree__item[aria-disabled="true"] { color: #6b7785; cursor: default; }
.pc-tree__child[aria-disabled="true"]:hover,
.pc-tree__item[aria-disabled="true"]:hover { background: transparent; color: #6b7785; }

/* ---------- sidebar: icon rows, section labels, nested sub-branches ----------
   The CRM build (templates/base-crm.html) carries a per-section icon on each
   group row, a "Configuration" divider, and one further level of nesting
   (e.g. Communications > WhatsApp). These extend the tree above using the
   same tokens, spacing, transitions and active-state treatment. */

/* A group row with its own icon uses it as the marker — drop the bullet dot
   so the two don't both show. */
.pc-tree__item--icon::before { display: none; }

.pc-tree__icon {
  width: 24px; height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--pc-r-sm);
  color: var(--pc-navy-muted);
  transition: color 0.14s ease, background-color 0.14s ease;
}
.pc-tree__icon svg { width: 16px; height: 16px; display: block; }
.pc-tree__item:hover .pc-tree__icon { color: #fff; }
.pc-tree__item[aria-current="page"] .pc-tree__icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}
.pc-tree__item--branch-active .pc-tree__icon {
  color: var(--pc-green);
  background: rgba(61, 181, 74, 0.14);
}

/* Section divider label between groups (e.g. "Configuration"). */
.pc-tree__section-label {
  margin: 14px 0 6px;
  padding: 0 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pc-navy-muted);
}

/* Sub-branch toggle — sits inside .pc-tree__children-inner, so it reads as a
   heavier .pc-tree__child that carries a caret. */
.pc-tree__subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-radius: var(--pc-r-md);
  background: transparent;
  color: var(--pc-navy-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.pc-tree__subitem:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.pc-tree__subitem[aria-expanded="true"] { color: #fff; }
.pc-tree__subitem .pc-tree__label { flex: 1; }
.pc-tree__subitem .pc-tree__caret { width: 11px; height: 11px; }
.pc-tree__subitem[aria-expanded="true"] .pc-tree__caret { transform: rotate(0deg); }

/* Sub-branch panel — same collapse mechanics as .pc-tree__children, indented
   one level deeper. */
.pc-tree__subchildren {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.24s ease, opacity 0.18s ease;
}
.pc-tree__subchildren[data-open="true"] { opacity: 1; }
.pc-tree__subchildren-inner {
  margin: 2px 0 6px 8px;
  padding-left: 11px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pc-tree__subchildren-inner .pc-tree__child { font-size: 12.5px; padding: 7px 10px; }

.pc-sidebar__foot {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--pc-navy-muted);
  font-size: 11.5px;
  font-weight: 500;
}
.pc-sidebar__foot::before {
  content: "";
  width: 8px; height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--pc-green);
}

.pc-scrim {
  position: fixed;
  inset: 0;
  background: rgba(12, 26, 43, 0.45);
  z-index: 80;
}

/* ---------- top bar ---------- */
.pc-topbar {
  height: 66px;
  flex: none;
  background: var(--pc-bg);
  border-bottom: 1px solid var(--pc-border);
  padding: 0 clamp(16px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pc-s4);
  position: sticky;
  top: 0;
  z-index: 40;
}
.pc-topbar__left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pc-topbar__burger {
  width: 38px; height: 38px;
  flex: none;
  display: none;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-r-md);
  background: var(--pc-surface);
  color: var(--pc-ink);
  cursor: pointer;
  place-items: center;
}
.pc-crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--pc-muted-2);
  margin-bottom: 2px;
}
.pc-crumbs a { color: var(--pc-muted-2); }
.pc-crumbs a:hover { color: var(--pc-ink-2); }
.pc-crumbs__sep { color: #c9c6bd; }
.pc-crumbs__current { color: var(--pc-ink-2); }
.pc-topbar__title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-topbar__right { display: flex; align-items: center; gap: var(--pc-s2); position: relative; }

.pc-icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-r-lg);
  background: var(--pc-surface);
  color: var(--pc-ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.pc-icon-btn:hover { border-color: var(--pc-border-strong); }
.pc-icon-btn__dot {
  position: absolute;
  top: 7px; right: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--pc-red);
  border: 1.5px solid var(--pc-surface);
}

.pc-user-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 11px 5px 5px;
  border: 1px solid var(--pc-border);
  background: var(--pc-surface);
  border-radius: var(--pc-r-pill);
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--pc-ink);
}
.pc-user-btn:hover { border-color: var(--pc-border-strong); }
.pc-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--pc-navy);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.pc-menu {
  position: absolute;
  top: 50px;
  right: 0;
  width: 232px;
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: 14px;
  box-shadow: var(--pc-shadow-md);
  padding: 8px;
  z-index: 70;
  animation: pc-rise 0.14s ease-out;
}
.pc-menu--wide { width: 340px; max-width: calc(100vw - 32px); padding: 0; overflow: hidden; }
.pc-menu__head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--pc-surface-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}
.pc-menu__id { padding: 10px 12px 12px; border-bottom: 1px solid var(--pc-surface-3); margin-bottom: 6px; }
.pc-menu__name { font-size: 13.5px; font-weight: 700; }
.pc-menu__role { font-size: 12px; color: var(--pc-muted); }
.pc-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  background: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--pc-ink);
  cursor: pointer;
}
.pc-menu__item:hover { background: var(--pc-bg); text-decoration: none; color: var(--pc-ink); }
.pc-menu__item--danger { color: #c24a4a; }

.pc-notif {
  padding: 13px 15px;
  border-bottom: 1px solid var(--pc-bg);
  display: flex;
  gap: 11px;
}
.pc-notif__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--pc-muted-2); }
.pc-notif__dot--warn { background: var(--pc-amber); }
.pc-notif__dot--danger { background: var(--pc-red); }
.pc-notif__dot--ok { background: var(--pc-green); }
.pc-notif__title { font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.pc-notif__body { font-size: 12.5px; color: var(--pc-muted); line-height: 1.5; }
.pc-notif__time { font-size: 11.5px; color: var(--pc-muted-2); margin-top: 5px; font-weight: 600; }
.pc-menu__foot {
  width: 100%;
  padding: 12px;
  border: 0;
  background: var(--pc-surface-2);
  color: var(--pc-green-deep);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.pc-menu__foot:hover { background: var(--pc-surface-3); }

.pc-search { position: relative; margin-right: 4px; }
.pc-search input {
  width: 224px;
  height: 40px;
  padding: 0 14px 0 36px;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-r-lg);
  outline: none;
  color: var(--pc-ink);
}
.pc-search input:focus { border-color: var(--pc-green); box-shadow: 0 0 0 3px rgba(61, 181, 74, 0.12); }
.pc-search svg { position: absolute; left: 12px; top: 12px; color: var(--pc-muted-2); }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .pc-sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    height: auto;
    z-index: 90;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.4);
    transform: translateX(-102%);
    transition: transform 0.26s ease;
  }
  .pc-shell[data-drawer="open"] .pc-sidebar { transform: translateX(0); }
  .pc-sidebar__close { display: grid; }
  .pc-topbar__burger { display: grid; }
  .pc-search { display: none; }
}

@media (max-width: 759px) {
  .pc-user-btn__name { display: none; }
  .pc-user-btn { padding: 5px; }
}
