/* =====================================================================
   Header "···" dropdown — Dark Mode / Refresh Data / Sign Out

   The overflow button added beside "Need Help?" (Figma Navigtion_v2,
   17454:39408) opens this panel. Shared by every page in the flow that
   carries the header, so the rows, the switch and the motion live here
   once instead of in eight inline <style> blocks.

   Rows, icons and the destructive red follow the profile menu this
   prototype already ships in accounts copy.html — same 20px Phosphor
   glyphs, same #f7f9fa hover, same #d0134c for Sign Out — so the two
   dropdowns in the product read as one component.
   ===================================================================== */

/* the panel is anchored to the button, not the viewport: the header is
   fixed, so an absolutely positioned panel tracks the button through
   scroll and resize without any JS placement. */
.header-actions {
    position: relative;
}

.header-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 200;
    min-width: 232px;
    /* hug the rows, but never run off the screen — scroll instead */
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    padding: 8px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(0, 14, 30, 0.18),
        0 2px 6px rgba(0, 14, 30, 0.06);
    transform-origin: top right;
    /* `visibility` rather than `display`, so the panel keeps its measured
       size and can scale up from where it already is. */
    visibility: hidden;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.15s ease, transform 0.15s ease,
        visibility 0s linear 0.15s;
}

.header-menu.is-open {
    visibility: visible;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

.header-menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background-color: transparent;
    color: #1d2d38;
    font-family: inherit;
    font-size: 16px;
    /* regular, as the profile menu's rows are — a dropdown label is not a
       heading, and 400 keeps the destructive row from shouting */
    font-weight: 400;
    line-height: 24px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.header-menu__item:hover,
.header-menu__item:focus-visible {
    background-color: #f7f9fa;
    outline: none;
}

.header-menu__item:focus-visible {
    box-shadow: inset 0 0 0 1px rgba(28, 129, 230, 0.45);
}

.header-menu__item i {
    flex-shrink: 0;
    font-size: 20px;
    color: #425461;
}

.header-menu__label {
    flex: 1;
}

.header-menu__sep {
    height: 1px;
    margin: 8px 12px;
    background-color: #dce2e6;
}

/* Sign Out is the only destructive row, so it is the only one that leaves
   the neutral text colour — icon and label together, no red fill. */
.header-menu__item--signout,
.header-menu__item--signout i {
    color: #d0134c;
}

.header-menu__item--signout:hover,
.header-menu__item--signout:focus-visible {
    background-color: #fdf2f4;
}

/* ---- the Dark Mode switch ----
   The knob is the one part that slides: it is a physical control being
   thrown, not a state fading in. */
.header-menu__switch {
    position: relative;
    flex-shrink: 0;
    width: 34px;
    height: 20px;
    border-radius: 100px;
    background-color: #c5ced6;
    transition: background-color 0.2s ease;
}

.header-menu__switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #ffffff;
    transition: transform 0.22s ease;
}

.header-menu__item[aria-checked="true"] .header-menu__switch {
    background-color: #1c81e6;
}

.header-menu__item[aria-checked="true"] .header-menu__switch::after {
    transform: translateX(14px);
}

@media (max-width: 640px) {
    /* the button it hangs from is the last thing left in the header at
       this width, so the panel stays with it and simply narrows. */
    .header-menu {
        min-width: 208px;
    }
}
