.global-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.global-actions__menu { position: relative; }

.global-actions button,
.global-actions a,
.global-dialog button,
.global-dialog input,
.global-dialog textarea { font: inherit; }

.global-actions__icon-button,
.global-actions__account-button {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
  cursor: pointer;
}

.global-actions__icon-button:hover,
.global-actions__account-button:hover { background: var(--hover); }
.global-actions__icon-button svg { width: 19px; height: 19px; }

.global-actions__icon-button:focus-visible,
.global-actions__account-button:focus-visible,
.global-actions__tab:focus-visible,
.global-actions__item:focus-visible,
.global-actions__notification--button:focus-visible,
.global-dialog button:focus-visible,
.global-dialog input:focus-visible,
.global-dialog textarea:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), .25);
  outline-offset: 2px;
}

.global-actions__badge,
.global-actions__tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
}

.global-actions__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  box-shadow: 0 0 0 2px var(--header-bg);
}

.global-actions__badge[hidden],
.global-actions__tab-badge[hidden] { display: none; }

.global-actions__account-button {
  gap: 8px;
  width: auto;
  max-width: 180px;
  padding: 0 11px 0 4px;
}

.global-actions__avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-text, #fff);
  font-size: 13px;
  font-weight: 750;
}

.global-actions__account-name {
  overflow: hidden;
  max-width: 116px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.global-actions__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  overflow: hidden;
  width: min(340px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.global-actions__dropdown[hidden] { display: none; }
.global-actions__notifications { max-height: min(520px, calc(100vh - 80px)); }
.global-actions__account { width: min(260px, calc(100vw - 24px)); padding: 8px; }

.global-actions__tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.global-actions__tab {
  appearance: none;
  min-width: 0;
  margin: 0;
  padding: 8px 4px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.global-actions__tab.is-active {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.global-actions__tab-badge { margin-left: 3px; vertical-align: 1px; }
.global-actions__list { overflow-y: auto; max-height: 330px; padding: 8px; }
.global-actions__list[hidden] { display: none; }

.global-actions__notification {
  display: block;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}

.global-actions__notification:hover { background: var(--hover); }
.global-actions__notification--button { appearance: none; margin: 0; cursor: pointer; }
.global-actions__question { font-weight: 650; }
.global-actions__time { margin-top: 3px; color: var(--muted); font-size: 11px; }
.global-actions__section-label { padding: 7px 10px 2px; color: var(--muted); font-size: 11px; font-weight: 700; }
.global-actions__empty { padding: 24px 10px; color: var(--muted); font-size: 13px; text-align: center; }

.global-actions__state {
  display: inline-flex;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.global-actions__state--open { background: rgba(var(--accent-rgb), .15); color: var(--accent); }
.global-actions__state--answered { background: rgba(var(--green-rgb), .15); color: var(--green); }

.global-actions__item {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.global-actions__item:hover { background: var(--hover); }
.global-actions__item:disabled { cursor: wait; opacity: .65; }
.global-actions__push { border-top: 1px solid var(--border); border-radius: 0; }
.global-actions__danger { color: var(--red); }

.global-actions__account-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
  padding: 8px 11px 11px;
  border-bottom: 1px solid var(--border);
}

.global-actions__account-info strong { overflow-wrap: anywhere; font-size: 14px; }
.global-actions__account-info span { color: var(--muted); font-size: 12px; }
.global-actions__status { margin: 4px 10px; color: var(--red); font-size: 12px; line-height: 1.4; }
.global-actions__status:empty { display: none; }
.global-actions__version { display: block; padding: 6px 11px 2px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.global-actions__version[hidden] { display: none; }

.global-dialog {
  width: min(500px, calc(100vw - 24px));
  max-height: min(720px, calc(100vh - 24px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.global-dialog::backdrop { background: var(--scrim); }
.global-dialog__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.global-dialog__header h2 { margin: 0; color: var(--text); font-size: 18px; }
.global-dialog__close { appearance: none; width: 34px; height: 34px; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); cursor: pointer; }
.global-dialog__body { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: calc(100vh - 100px); margin: 0; padding: 18px; }
.global-dialog__body label { display: flex; flex-direction: column; gap: 6px; margin: 0; color: var(--text); font-size: 13px; font-weight: 600; }
.global-dialog__body input,
.global-dialog__body textarea { width: 100%; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.global-dialog__body textarea { resize: vertical; }
.global-dialog__body > button,
.global-dialog__body form > button { margin: 0; }
.global-dialog__meta { margin: 0 0 8px; }
.global-dialog__block { margin-bottom: 9px; padding: 11px 12px; border-radius: 11px; background: var(--surface-2); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.global-dialog__block--question { background: rgba(var(--accent-rgb), .12); }
.global-dialog__block--reply { background: rgba(var(--green-rgb), .1); }
.global-dialog__block strong { display: block; margin-bottom: 4px; font-size: 11px; }
.global-dialog__status { min-height: 18px; color: var(--red); font-size: 12px; }

dialog.password-dialog {
  box-sizing: border-box;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  height: fit-content;
  inset: 0;
  overflow-y: auto;
  border-radius: 24px;
  font: 14px/1.5 var(--font);
}
dialog.password-dialog[open] { display: block; }
.password-dialog *, .password-dialog *::before, .password-dialog *::after { box-sizing: border-box; }
.password-dialog__header { display: flex; align-items: center; gap: 14px; padding: 28px 28px 0; }
.password-dialog__icon { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; border: 1px solid rgba(var(--accent-rgb), .16); border-radius: 15px; background: rgba(var(--accent-rgb), .08); color: var(--accent); }
.password-dialog__icon svg { width: 25px; height: 25px; }
.password-dialog__eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
.password-dialog__header h2 { margin: 0; color: var(--text); font: 700 21px/1.35 var(--font); letter-spacing: -.04em; }
.password-dialog__header .global-dialog__close { flex: 0 0 32px; width: 32px; height: 32px; margin-left: auto; border-color: transparent; background: transparent; color: var(--muted); }
.password-dialog__header .global-dialog__close:hover { background: var(--hover); color: var(--text); }
.password-dialog__description { margin: 18px 28px 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.password-dialog__form { margin: 0; padding: 0; }
.password-dialog__fields { display: flex; flex-direction: column; gap: 20px; padding: 26px 28px 24px; }
.password-dialog__fields label { display: flex; flex-direction: column; gap: 8px; margin: 0; color: var(--text); font-size: 13px; font-weight: 600; }
.password-dialog__fields input { appearance: none; width: 100%; height: 48px; margin: 0; padding: 0 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text); box-shadow: none; font: 400 14px/1.5 var(--font); }
.password-dialog__fields input::placeholder { color: var(--muted); opacity: .75; }
.password-dialog__fields input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12); }
.password-dialog__help { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
.password-dialog__notice { margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.65; }
.password-dialog__status { padding: 11px 14px; border-radius: 10px; background: rgba(var(--red-rgb), .08); color: var(--red); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.password-dialog__status:empty { display: none; }
.password-dialog__status[data-state="success"] { background: rgba(var(--green-rgb), .09); color: var(--green); }
.password-dialog__status[data-state="pending"] { background: var(--surface-2); color: var(--muted); }
.password-dialog__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 28px; border-top: 1px solid var(--border); background: var(--surface-2); }
.password-dialog__footer button { appearance: none; display: inline-flex; align-items: center; justify-content: center; width: auto; min-height: 44px; margin: 0; padding: 10px 18px; border: 1px solid var(--border); border-radius: 11px; box-shadow: none; font: 600 13px/1.5 var(--font); cursor: pointer; }
.password-dialog__footer .password-dialog__cancel { background: var(--surface); color: var(--text); }
.password-dialog__footer .password-dialog__cancel:hover { background: var(--hover); }
.password-dialog__footer .password-dialog__submit { min-width: 145px; border-color: var(--button-bg); background: var(--button-bg); color: #fff; }
.password-dialog__footer .password-dialog__submit:hover { border-color: var(--button-hover); background: var(--button-hover); }
.password-dialog__footer button:disabled { opacity: .65; cursor: wait; }

@media (max-width: 520px) {
  dialog.password-dialog { width: calc(100vw - 24px); border-radius: 20px; }
  .password-dialog__header { gap: 12px; padding: 22px 20px 0; }
  .password-dialog__header h2 { font-size: 19px; }
  .password-dialog__description { margin: 16px 20px 0; font-size: 12px; }
  .password-dialog__fields { gap: 18px; padding: 22px 20px; }
  .password-dialog__fields input { font-size: 16px; }
  .password-dialog__footer { padding: 16px 20px; }
  .password-dialog__footer .password-dialog__submit { flex: 1; min-width: 0; }
}

@media (max-width: 520px) {
  .global-actions { gap: 6px; }
  .global-actions__account-button { width: 38px; padding: 0; }
  .global-actions__account-name { display: none; }
  .global-actions__dropdown { position: fixed; top: 62px; right: 8px; width: min(340px, calc(100vw - 16px)); }
  .global-actions__account { width: min(260px, calc(100vw - 16px)); }
  .global-actions__list { max-height: min(330px, calc(100vh - 180px)); }
}

@media (max-width: 340px) {
  .global-actions__tab { font-size: 11px; }
  .global-actions__dropdown { right: 4px; width: calc(100vw - 8px); }
  .global-actions__account { width: min(250px, calc(100vw - 8px)); }
  .global-dialog { width: calc(100vw - 12px); }
  .global-dialog__header, .global-dialog__body { padding: 14px; }
}
