/* Hub efficiency v257: isolated, additive controls. Existing cards and data flows are unchanged. */

.hub-session-check-v257 {
  position: fixed;
  z-index: 6100;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  width: min(420px, calc(100vw - 24px));
  transform: translateX(-50%);
  color: #f7fbff;
  pointer-events: none;
}

.hub-session-check-v257 > div {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 11px;
  align-items: center;
  padding: 13px 15px;
  border: 1px solid rgba(154, 184, 224, .24);
  border-radius: 16px;
  background: rgba(13, 29, 51, .97);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .28);
  text-align: left;
}

.hub-session-check-v257 span {
  width: 26px;
  height: 26px;
  grid-row: 1 / span 2;
  border: 3px solid rgba(143, 182, 231, .28);
  border-top-color: #69a9ff;
  border-radius: 50%;
  animation: hub-efficiency-spin-v257 .8s linear infinite;
}

.hub-session-check-v257 strong { grid-column: 2; font-size: 14px; }
.hub-session-check-v257 small { grid-column: 2; color: #aebfd5; font-size: 10px; line-height: 1.45; }

@keyframes hub-efficiency-spin-v257 { to { transform: rotate(1turn); } }

.page-hub .hub-shortcuts-open-v257 {
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  white-space: nowrap;
}

body.is-access-locked .hub-shortcuts-open-v257,
body:has(dialog[open]) .hub-shortcuts-open-v257 {
  visibility: hidden;
  pointer-events: none;
}

#hub-shortcuts-dialog-v257 {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: min(760px, calc(100dvh - 40px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line, #8ca7c5) 82%, transparent);
  border-radius: 22px;
  background: var(--surface, #fff);
  color: var(--text, #12233a);
  box-shadow: 0 28px 90px rgba(3, 18, 39, .34);
}

#hub-shortcuts-dialog-v257::backdrop,
#hub-urgent-dialog-v257::backdrop {
  background: rgba(3, 14, 30, .68);
  backdrop-filter: blur(5px);
}

.hub-shortcuts-panel-v257 {
  display: grid;
  max-height: min(760px, calc(100dvh - 40px));
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--surface, #fff);
}

.hub-shortcuts-head-v257,
.hub-drawer-head-v257 {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line, #d3deea);
}

.hub-shortcuts-head-v257 { padding: 20px 20px 12px; }
.hub-shortcuts-head-v257 p,
.hub-shortcuts-head-v257 h2,
.hub-drawer-head-v257 p,
.hub-drawer-head-v257 h2 { margin: 0; }
.hub-shortcuts-head-v257 p,
.hub-drawer-head-v257 p {
  color: var(--muted, #61748b);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}
.hub-shortcuts-head-v257 h2,
.hub-drawer-head-v257 h2 { margin-top: 3px; font-size: 22px; }

.hub-shortcuts-head-v257 > button,
.hub-drawer-head-v257 > button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line, #c5d3e2);
  border-radius: 13px;
  background: var(--surface2, #edf3f9);
  color: var(--text, #12233a);
  font: 900 22px/1 system-ui, sans-serif;
  cursor: pointer;
}

.hub-shortcuts-search-wrap-v257 {
  display: grid;
  gap: 5px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line, #d3deea);
  color: var(--muted, #61748b);
  font-size: 11px;
  font-weight: 850;
}

#hub-shortcuts-search-v257 {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line, #b9cada);
  border-radius: 13px;
  background: var(--surface, #fff);
  color: var(--text, #12233a);
  font: 750 15px/1.3 system-ui, sans-serif;
}

.hub-shortcuts-groups-v257 {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 16px 20px 18px;
  overflow: auto;
  overscroll-behavior: contain;
}

.hub-shortcuts-group-v257 { display: grid; gap: 8px; }
.hub-shortcuts-group-v257[hidden] { display: none; }
.hub-shortcuts-group-v257 h3 {
  margin: 0;
  color: var(--muted, #61748b);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .04em;
}
.hub-shortcuts-list-v257 { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.hub-shortcut-row-v257 {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}
.hub-shortcut-row-v257[hidden] { display: none; }
.hub-shortcut-main-v257,
.hub-shortcut-newtab-v257 {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border: 1px solid var(--line, #c5d3e2);
  border-radius: 12px;
  background: var(--surface2, #edf3f9);
  color: var(--text, #12233a);
  font: 850 13px/1.35 "Leelawadee UI", "Noto Sans Thai", Tahoma, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.hub-shortcut-main-v257 {
  min-width: 0;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  text-align: left;
}
.hub-shortcut-main-v257 span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-shortcut-main-v257 b { color: #185a9d; }
.hub-shortcut-newtab-v257 {
  width: 48px;
  justify-content: center;
  padding: 0;
  color: #185a9d;
}
.hub-shortcut-newtab-v257 span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.hub-shortcut-main-v257:hover,
.hub-shortcut-newtab-v257:hover {
  border-color: #4b89cb;
  background: color-mix(in srgb, var(--surface2, #edf3f9) 72%, #cde5ff);
}
html[data-dark="true"] .hub-shortcut-main-v257 b,
html[data-dark="true"] .hub-shortcut-newtab-v257 { color: #9dccff; }
.hub-shortcuts-empty-v257 {
  margin: 0;
  padding: 12px 20px 20px;
  color: var(--muted, #61748b);
  font-size: 13px;
  text-align: center;
}
.hub-shortcuts-empty-v257[hidden] { display: none; }

#hub-urgent-dialog-v257 {
  width: min(500px, calc(100vw - 24px));
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--line, #c5d3e2);
  border-radius: 22px 0 0 22px;
  background: var(--surface, #fff);
  color: var(--text, #12233a);
  box-shadow: -24px 0 72px rgba(3, 18, 39, .3);
}

.hub-drawer-panel-v257 {
  display: grid;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--surface, #fff);
}
.hub-drawer-head-v257 { padding: 20px; }
.hub-drawer-head-v257 span {
  display: inline-block;
  margin-top: 7px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface2, #edf3f9);
  color: #2d6dad;
  font-size: 11px;
  font-weight: 900;
}
html[data-dark="true"] .hub-drawer-head-v257 span { color: #9dccff; }
.hub-urgent-list-v257 {
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 16px 20px;
  overflow: auto;
  overscroll-behavior: contain;
}
.hub-urgent-row-v257 {
  display: grid;
  min-height: 58px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line, #c9d5e3);
  border-radius: 13px;
  background: var(--surface2, #edf3f9);
  color: var(--text, #12233a);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.hub-urgent-row-v257:hover { border-color: #4389dc; }
.hub-urgent-row-v257 > b {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: #dcecff;
  color: #205eaa;
  font-size: 17px;
}
.hub-urgent-row-v257 > span { display: grid; min-width: 0; gap: 2px; }
.hub-urgent-row-v257 strong { font-size: 13px; }
.hub-urgent-row-v257 small { color: var(--muted, #61748b); font-size: 10px; }
.hub-urgent-row-v257 i { color: #2d75cc; font-style: normal; font-weight: 950; }
.hub-urgent-row-v257[data-tone="critical"] { border-color: rgba(199, 58, 82, .42); }
.hub-urgent-row-v257[data-tone="critical"] > b { background: #ffe0e5; color: #ad203a; }
.hub-urgent-row-v257[data-tone="attention"] > b { background: #fff1cc; color: #865807; }
.hub-urgent-state-v257 {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line, #c9d5e3);
  border-radius: 13px;
  color: var(--muted, #61748b);
  font-size: 13px;
  line-height: 1.55;
}
.hub-drawer-note-v257 {
  margin: 0;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line, #d3deea);
  color: var(--muted, #61748b);
  font-size: 10px;
  line-height: 1.5;
}

.hub-mobile-compact-toggle-v257 { display: none; }

#hub-command-dashboard-v228,
#hub-company-dashboard-v245,
#hub-department-floor-v228,
#news-board-title,
#hub-command-history-v239 { scroll-margin-top: 18px; }

@media (max-width: 700px) {
  .hub-shortcuts-open-v257 {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 1400;
    padding: 0 15px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 999px;
    background: #155da8;
    color: #fff;
    box-shadow: 0 12px 34px rgba(5, 31, 63, .28);
  }
  body.page-hub .topbar .top-actions > .hub-shortcuts-open-v257 {
    width: auto;
    height: 44px;
    min-height: 44px;
    max-width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
  }
  #hub-shortcuts-dialog-v257 {
    width: 100%;
    max-height: min(88dvh, 760px);
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 22px 22px 0 0;
  }
  .hub-shortcuts-panel-v257 { max-height: min(88dvh, 760px); }
  .hub-shortcuts-head-v257 { padding: 16px 14px 10px; }
  .hub-shortcuts-search-wrap-v257 { padding: 11px 14px; }
  .hub-shortcuts-groups-v257 { padding: 14px; }
  .hub-shortcut-newtab-v257 { width: auto; min-width: 112px; gap: 5px; padding: 0 10px; }
  .hub-shortcut-newtab-v257 span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    font-size: 10px;
  }
  #hub-urgent-dialog-v257 {
    width: 100%;
    height: min(88dvh, 760px);
    margin: auto 0 0;
    border-top: 1px solid var(--line, #c5d3e2);
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }
  .hub-drawer-head-v257 { padding: 16px 14px 12px; }
  .hub-urgent-list-v257 { padding: 14px; }
  .hub-drawer-note-v257 { padding-inline: 14px; }

  .hub-mobile-compact-toggle-v257 {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    justify-self: start;
    padding: 0 13px;
    border: 1px solid var(--line, #b9cada);
    border-radius: 12px;
    background: var(--surface2, #edf3f9);
    color: var(--text, #12233a);
    font: 850 12px/1.3 "Leelawadee UI", "Noto Sans Thai", Tahoma, sans-serif;
    cursor: pointer;
  }
  .hub-mobile-compact-toggle-v257[aria-pressed="true"] {
    border-color: #4389dc;
    background: #dcecff;
    color: #164f91;
  }

  html[data-hub-mobile-compact="true"] .hub-command-pipeline-list-v228 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  html[data-hub-mobile-compact="true"] .hub-command-pipeline-list-v228 > button {
    display: grid;
    min-height: 68px;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 3px 6px;
    align-items: center;
    padding: 8px;
    text-align: left;
  }
  html[data-hub-mobile-compact="true"] .hub-command-pipeline-list-v228 > button::after { content: none; }
  html[data-hub-mobile-compact="true"] .hub-command-pipeline-list-v228 > button > span {
    grid-column: 1;
    grid-row: 1;
  }
  html[data-hub-mobile-compact="true"] .hub-command-pipeline-list-v228 > button > strong {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
    margin: 0;
    font-size: 12px;
    line-height: 1.3;
  }
  html[data-hub-mobile-compact="true"] .hub-command-pipeline-list-v228 > button > b {
    grid-column: 3;
    grid-row: 1 / span 2;
    margin: 0;
    font-size: 22px;
  }
  html[data-hub-mobile-compact="true"] .hub-command-pipeline-list-v228 > button > small {
    grid-column: 1 / 3;
    grid-row: 2;
    justify-self: start;
    margin: 0;
    font-size: 11px;
  }
  html[data-hub-mobile-compact="true"] .hub-command-pipeline-list-v228 > button > small:empty { display: none; }
}

@media (max-width: 360px) {
  .hub-shortcut-row-v257 { grid-template-columns: 1fr; }
  .hub-shortcut-newtab-v257 { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .hub-session-check-v257 span { animation: none; }
  #hub-shortcuts-dialog-v257,
  #hub-urgent-dialog-v257,
  .hub-shortcuts-open-v257 { scroll-behavior: auto !important; transition: none !important; }
}
