.layout-header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.layout-header > select {
  max-width: 210px;
}
.layout-screen-select {
  display: flex;
  gap: 3px;
  max-width: 340px;
  overflow-x: auto;
}
.layout-screen-select button {
  white-space: nowrap;
}
.layout-screen-overflow {
  display: none;
  max-width: 140px;
}
.layout-header.has-many-screens .layout-screen-select {
  display: none;
}
.layout-header.has-many-screens .layout-screen-overflow {
  display: block;
}
.layout-screen-select button[aria-pressed="true"] {
  background: #244b6b;
  border-color: #58a6ff;
  color: #fff;
}
.layout-dialog {
  background: #17212c;
  color: #e6edf3;
  border: 1px solid #566575;
  border-radius: 8px;
  width: min(880px, calc(100vw - 40px));
  max-height: 85vh;
  padding: 20px;
  box-shadow: 0 16px 60px #0008;
}
.layout-dialog::backdrop {
  background: #0009;
}
.layout-dialog h2 {
  margin-top: 0;
  font-size: 1.2rem;
}
.layout-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.layout-dialog label {
  display: flex;
  gap: 8px;
  align-items: center;
}
.layout-dialog input:not([type="checkbox"]),
.layout-dialog textarea,
.layout-dialog select {
  flex: 1;
  min-width: 0;
  background: #101820;
  color: inherit;
  border: 1px solid #566575;
  border-radius: 4px;
  padding: 7px;
}
.layout-dialog button {
  color: inherit;
  background: #263746;
  border: 1px solid #566575;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  margin: 3px;
}
.layout-dialog button:focus-visible,
.layout-header button:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}
.layout-template-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}
.layout-template-card {
  border: 1px solid #465463;
  border-radius: 6px;
  padding: 12px;
}
.layout-template-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.layout-preview {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.layout-preview > div {
  border: 1px solid #566575;
  border-radius: 3px;
  padding: 8px;
  min-width: 90px;
  flex: 1;
}
.layout-preview small {
  display: block;
  color: #a9bdce;
  margin-top: 5px;
}
.layout-screen-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.layout-unassigned {
  position: absolute;
  inset: 30% 10%;
  text-align: center;
  color: #a9bdce;
  pointer-events: none;
}
@media (max-width: 1000px) {
  .layout-screen-select {
    display: none;
  }
  .layout-screen-overflow {
    display: block;
  }
  .layout-header > select {
    max-width: 140px;
  }
}

/* Shared native menu rows: the main label selects; adjacent controls save/add. */
.app-menu-row {
  display: flex;
  align-items: center;
}
.app-menu-row > button:first-child {
  flex: 1;
  min-width: 0;
  width: auto;
}
.app-menu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}
.app-menu-badge {
  margin-left: auto;
  padding-left: 8px;
  color: #9aafc1;
  font-size: 0.58rem;
}
.app-menu-row > .app-menu-inline-action {
  flex: 0 0 28px;
  width: 28px;
  justify-content: center;
  padding: 4px;
  color: #b8d6ef;
  border-left: 1px solid #30363d;
}
.app-menu-caption {
  padding: 6px 7px;
  color: #9aafc1;
  font-size: 0.59rem;
  max-width: 360px;
}
.app-submenu {
  position: fixed;
  max-height: calc(100vh - 16px);
  max-width: calc(100vw - 16px);
  overflow-y: auto;
}
.app-menu-popover {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.app-menu-row > [aria-current="true"] {
  background: #203b50;
  color: #e4f3ff;
}
.layout-sharing {
  border: 1px solid #465463;
  border-radius: 4px;
  padding: 8px;
}
.layout-sharing summary {
  cursor: pointer;
}
.layout-sharing[open] > label {
  margin-top: 10px;
}
