/* Header / sidebar / dashboard layout refinement v2.21.0.1 */
.brand {
  gap: 10px;
}
.brand-copy {
  flex: 1 1 auto;
}
.sidebar-brand-toggle {
  margin-left: auto;
}
.topbar {
  gap: 12px;
}
.top-title {
  flex: 1 1 auto;
}
.top-facility-name {
  display: block !important;
  margin: 4px 0 0 !important;
  color: var(--muted) !important;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}
.header-tools {
  margin-left: auto;
}
.user-menu {
  position: relative;
  flex: 0 0 auto;
}
.user-menu-trigger {
  cursor: pointer;
}
.user-menu-trigger i {
  margin-left: 2px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}
.user-dropdown {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(15,23,42,.16);
}
.user-dropdown[hidden] {
  display: none !important;
}
.user-dropdown button {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  font-weight: 800;
  text-align: left;
}
.user-dropdown button:hover,
.user-dropdown button:focus-visible {
  background: var(--red-soft);
  color: var(--red);
  outline: none;
}
.dashboard-tabs-with-fiscal {
  justify-content: space-between;
  overflow: visible;
}
.dashboard-tab-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
}
.dashboard-fiscal-filter {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.dashboard-fiscal-filter select {
  min-width: 126px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 34px 0 12px;
  color: var(--text);
  background: var(--surface);
  font-weight: 700;
}
.sidebar-mobile-edge-toggle {
  display: none;
}
.app-shell.sidebar-collapsed .brand {
  flex-wrap: wrap;
}
.app-shell.sidebar-collapsed .sidebar-brand-toggle {
  margin-left: 0;
}

@media (max-width: 1180px) and (min-width: 769px) {
  .brand {
    flex-direction: column;
    gap: 8px;
  }
  .sidebar-brand-toggle {
    margin-left: 0;
  }
  .topbar {
    flex-wrap: nowrap;
    min-height: 106px;
  }
  .top-title h1 {
    font-size: 18px;
  }
  .top-facility-name {
    font-size: 12px;
  }
  .header-tools {
    flex-wrap: nowrap;
  }
  .connection-status strong {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
@media (max-width: 768px) {
  .sidebar-mobile-edge-toggle {
    position: fixed;
    z-index: 54;
    top: 16px;
    left: 0;
    display: grid;
    place-items: center;
    width: 28px;
    height: 44px;
    border-radius: 0 10px 10px 0;
    color: #fff;
    background: #0f766e;
    box-shadow: 4px 6px 18px rgba(15,23,42,.2);
    font-size: 24px;
    font-weight: 900;
  }
  .app-shell.sidebar-open .sidebar-mobile-edge-toggle {
    display: none;
  }
  .topbar {
    grid-template-columns: minmax(0,1fr);
    gap: 10px;
    padding-left: 36px;
  }
  .top-title {
    grid-column: 1;
  }
  .top-title h1 {
    font-size: 15px;
  }
  .top-facility-name {
    font-size: 11px;
  }
  .header-tools {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0,1fr) 44px auto;
  }
  .user-chip b {
    display: inline;
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dashboard-tabs-with-fiscal {
    flex-wrap: wrap;
    gap: 8px;
  }
  .dashboard-tab-group {
    width: 100%;
  }
  .dashboard-fiscal-filter {
    width: 100%;
    justify-content: flex-end;
  }
}


/* Header brand lockup — typographic style inspired by SMART NCD reference */
.header-brand-lockup{
  flex:0 1 410px;
  min-width:300px;
  max-width:460px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  gap:0;
}
.header-brand-main{
  display:flex;
  align-items:center;
  gap:7px;
  line-height:.92;
  letter-spacing:-.035em;
  white-space:nowrap;
}
.header-brand-smart,
.header-brand-ncd{
  font-size:29px;
  font-weight:900;
}
.header-brand-smart{color:var(--text)}
.header-brand-ncd{color:#0ea5a4}
.header-brand-heart{
  display:inline-grid;
  place-items:center;
  width:27px;
  height:27px;
  margin-left:1px;
  border-radius:8px;
  background:#0ea5a4;
  color:#fff;
  font-size:14px;
  line-height:1;
  transform:translateY(-1px);
}
.header-brand-sub{
  margin-top:5px;
  color:#0b7285;
  font-size:11px;
  font-weight:800;
  letter-spacing:.34em;
  line-height:1;
  white-space:nowrap;
}
.header-brand-rule{
  width:252px;
  max-width:100%;
  height:2px;
  margin:5px 0 4px;
  border-radius:999px;
  background:linear-gradient(90deg,#0b4f79 0%,#0ea5a4 70%,rgba(14,165,164,0) 100%);
}
.header-brand-thai{
  color:var(--muted);
  font-size:11px;
  font-weight:700;
  line-height:1.15;
  white-space:nowrap;
}
body.dark .header-brand-smart{color:var(--text)}
body.dark .header-brand-sub{color:#67e8f9}
body.dark .header-brand-thai{color:var(--muted)}

@media (max-width:1180px) and (min-width:769px){
  .header-brand-lockup{flex-basis:330px;min-width:260px}
  .header-brand-smart,.header-brand-ncd{font-size:23px}
  .header-brand-heart{width:23px;height:23px;font-size:12px}
  .header-brand-sub{font-size:9px;letter-spacing:.3em}
  .header-brand-rule{width:215px;margin-top:4px}
  .header-brand-thai{font-size:10px}
}
@media (max-width:768px){
  .topbar{
    grid-template-columns:minmax(0,1fr);
  }
  .header-brand-lockup{
    grid-column:1;
    min-width:0;
    max-width:none;
    width:100%;
  }
  .header-brand-smart,.header-brand-ncd{font-size:20px}
  .header-brand-heart{width:21px;height:21px;border-radius:6px;font-size:11px}
  .header-brand-sub{font-size:8px;letter-spacing:.25em}
  .header-brand-rule{width:190px}
  .header-brand-thai{font-size:9px}
  .header-tools{grid-column:1}
}
