/* HIVE-618 — one visual contract for fixed right-side drawers.
   Behaviour and open-state selectors remain owned by each feature. */
:root {
    --drawer-w-sm: 360px;
    --drawer-w-md: 400px;
    --drawer-w-wide: 460px;
    --drawer-w-lg: 600px;
    --drawer-w-xl: 760px;
    --drawer-bug-gutter: 44px;
}

.hive-drawer {
    width: min(var(--hive-drawer-width, var(--drawer-w-md)), 100vw) !important;
    max-width: 100vw !important;
    background: var(--surface) !important;
    color: var(--text);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, .15) !important;
    transition-duration: .25s !important;
    transition-timing-function: ease !important;
}

.hive-drawer--sm { --hive-drawer-width: var(--drawer-w-sm); }
.hive-drawer--md { --hive-drawer-width: var(--drawer-w-md); }
.hive-drawer--wide { --hive-drawer-width: var(--drawer-w-wide); }
.hive-drawer--lg { --hive-drawer-width: var(--drawer-w-lg); }
.hive-drawer--xl { --hive-drawer-width: var(--drawer-w-xl); }

.hive-drawer-header {
    display: flex;
    align-items: center !important;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px !important;
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
}

.hive-drawer-header :is(h2, h3),
.hive-drawer-header > span:first-child {
    margin: 0;
    color: var(--text);
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.hive-drawer-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: var(--drawer-bug-gutter) !important;
}

.hive-drawer-action {
    flex: 0 0 auto;
    margin-right: var(--drawer-bug-gutter) !important;
}

.hive-drawer-actions .hive-drawer-action,
.hive-drawer-actions > :is(button, a) {
    margin-right: 0 !important;
}

.hive-drawer-icon-action,
.hive-drawer-actions > :is(button, a) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.hive-drawer-icon-action:hover,
.hive-drawer-actions > :is(button, a):hover {
    background: var(--surface-soft, var(--surface));
    color: var(--text);
}

/* Review fix (2026-07-31) — size preservation where the tier would have
   CHANGED an intentional width. The shared tiers unified the small header
   sidebars (notifications 320→360 to match messages) and nudged 380/390px
   drawers to 400px, which is the intended consolidation. These two are
   different: the tier would have SHRUNK a working drawer, which the plan
   ruled out.
     - Reminders branch drawer: 640px, and its calc() keeps a 48px sliver of
       the page visible on mid-width screens.
     - HiveRightDrawer: 520px; it is a shared component whose consumers were
       laid out against that width. */
.branch-config-drawer.hive-drawer {
    --hive-drawer-width: 640px;
    max-width: calc(100% - 48px) !important;
}

.rd-drawer.hive-drawer { --hive-drawer-width: 520px; }

/* HiveRightDrawer used a modal-level stack. Keep its backdrop below the
   global header launcher so the reserved gutter remains genuinely clickable. */
.rd-backdrop { z-index: 1090 !important; }
.rd-drawer.hive-drawer { z-index: 1100 !important; }

@media (max-width: 768px) {
    .hive-drawer {
        width: 100vw !important;
        max-width: 100vw !important;
    }
}
