/* Live topbar styles migrated from inline styles in main/_live_topbar.html */

/* Global webkit topbar must sit above fixed legacy sidebar (z-index 1030). */
#live-topbar-root.zel-topbar {
  z-index: 1040;
}
.topbar-notif-wrap { position: relative; }
.topbar-notif-wrap .notification-item {
  cursor: pointer;
}
.topbar-notif-wrap .notification-item:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.06));
}
.topbar-notif-wrap .notification-item.unread:hover {
  background: rgba(59, 130, 246, 0.14);
}
.topbar-notif-wrap .notification-title,
.topbar-notif-wrap .notification-item-message,
.topbar-notif-wrap .notification-ticket {
  text-decoration: none;
  cursor: pointer !important;
}
.topbar-notif-wrap .notification-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  min-width: 1.75rem;
}
.topbar-notif-wrap .notification-dismiss {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  width: 1.1rem;
  height: 1.1rem;
  line-height: 1;
  font-size: 0.7rem;
  color: var(--text-tertiary, #9ca3af);
  cursor: pointer;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: color 0.12s ease, opacity 0.12s ease;
}
.topbar-notif-wrap .notification-dismiss:hover {
  color: var(--color-danger, #ef4444);
  opacity: 1;
}
.topbar-notif-wrap .notification-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  /* right: 0; */
  right: -86px;
  width: 460px;
  background: var(--bg-dropdown, var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 200;
}
.topbar-notif-wrap .notification-list {
  max-height: calc(
    100dvh
    - var(--topbar-height, 3.5rem)
    - 4px          /* gap under bell (matches dropdown top) */
    - 3.25rem      /* .notification-dropdown-header */
    - -8px         /* bottom without breathing room */
  );
  overflow-y: auto;
}
.topbar-notif-wrap .notification-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.topbar-notif-count {
  position: absolute;
  top: -0.1rem;
  right: -0.275rem;
  min-width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.215rem;
  pointer-events: none;
}

.topbar-quick-actions {
  position: relative;
}

.topbar-quick-actions .quick-actions-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: -5px;
  left: auto;
  min-width: 13rem;
  background: var(--bg-dropdown, var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 210;
}

.topbar-quick-actions.open .quick-actions-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.topbar-quick-actions .quick-actions-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.topbar-quick-actions .quick-actions-item:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-quick-actions .quick-actions-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  color: var(--text-tertiary, #64748b);
  pointer-events: none;
}

.topbar-quick-actions .quick-actions-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.3rem 0;
}

/* Inline-style replacements */
.topbar-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 300;
}

.topbar-tenant-loading {
  padding: 0.75rem 0.85rem;
  font-size: 0.75rem;
}

.topbar-notif-btn {
  position: relative;
}

#tenantList .zel-tenant-item .zel-tenant-icon.zel-tenant-icon-lead {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-sm);
  background: rgba(31, 111, 235, 0.14);
  color: var(--accent-blue);
  font-size: 0.6rem;
  flex: 0 0 auto;
}

#tenantList .zel-tenant-item {
  padding: 0.34rem 0.45rem;
  gap: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--text-primary);
}

#tenantList .zel-tenant-item:hover,
#tenantList .zel-tenant-item.active {
  background: var(--bg-tertiary);
}

#tenantList .zel-tenant-item-body {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.5rem;
}

#tenantList .zel-tenant-item-name {
  flex: 1;
  min-width: 0;
  text-align: left;
}

#tenantList .zel-tenant-item-id {
  flex-shrink: 0;
  text-align: right;
}

.topbar-notif-count[hidden],
.topbar-notif-count.is-hidden {
  display: none;
}

.live-shell-system-notice {
  position: fixed;
  top: 12px;
  left: 200px;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;
}

.live-shell-system-notice__inner {
  max-width: 900px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  font-weight: 600;
  text-align: center;
  pointer-events: auto;
}

.v2-recent-tickets {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
  overflow: hidden;
  flex: 0 0 222px;
  max-height: 222px;
  transition: flex-basis 150ms ease, max-height 150ms ease;
}

.v2-recent-tickets.is-collapsed {
  flex-basis: 2.15rem;
  max-height: 2.15rem;
}

/* Keep .zel-nav-label typography; only make the header a flex click target */
button.v2-recent-tickets-label.zel-nav-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.45rem 0.1rem 0.45rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  flex-shrink: 0;
  /* Match .zel-nav-label exactly (button UA reset would otherwise change it) */
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  line-height: inherit;
}

.v2-recent-tickets-label__text {
  min-width: 0;
}

.v2-recent-tickets-label__chevron {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  opacity: 0.8;
  color: var(--text-secondary);
}

.v2-recent-tickets-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  opacity: 1;
  transition: opacity 150ms ease;
}

.v2-recent-tickets.is-collapsed .v2-recent-tickets-body {
  opacity: 0;
  pointer-events: none;
}

.v2-recent-loading {
  display: block;
  padding: 0.25rem 0.45rem;
  color: var(--text-secondary);
  font-size: 0.72rem;
}

#recent-tickets-list,
#v2-recent-tickets-list,
.v2-recent-tickets-body {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.35rem;
  row-gap: 0.1rem;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.1rem 0;
}

.v2-recent-tickets.is-collapsed #recent-tickets-list,
.v2-recent-tickets.is-collapsed #v2-recent-tickets-list,
.v2-recent-tickets.is-collapsed .v2-recent-tickets-body {
  overflow: hidden;
}

.v2-recent-ticket-item {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  min-width: 0;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none !important;
  transition: var(--transition);
  font-size: 0.82rem;
  line-height: 1.25;
}

.v2-recent-ticket-item:hover {
  background: rgba(31, 111, 235, 0.1);
  color: inherit;
}

@supports not (grid-template-columns: subgrid) {
  #recent-tickets-list,
  #v2-recent-tickets-list {
    display: block;
  }

  .v2-recent-ticket-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    grid-column: unset;
  }
}

.v2-recent-ticket-id {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  cursor: pointer;
}

.v2-recent-ticket-row {
  display: contents;
}

.v2-recent-ticket-subject {
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.v2-recent-ticket-item--title-only {
  display: block;
  overflow-x: hidden;
  overflow-y: visible;
  min-width: 0;
  line-height: 1.25;
  padding: 0.12rem 0.45rem;
}

.v2-recent-ticket-item--title-only .v2-recent-ticket-subject {
  display: block;
  font-weight: 400;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

/* Mobile: show search icon when inline topbar search is hidden */
.zel-topbar-search-trigger {
  display: none;
}

@media (max-width: 767.98px) {
  .zel-topbar-search-trigger {
    display: inline-flex;
  }
}

/* —— Command palette (Ctrl/Cmd+K) —— */
.zel-cmd-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(18vh, 8rem) 1rem 2rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.zel-cmd-palette {
  width: min(560px, 100%);
  max-height: min(70vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--bg-modal, var(--bg-secondary, #161b22));
  border: 1px solid var(--border-color, var(--border-primary, #30363d));
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-lg, 0 16px 48px rgba(0, 0, 0, 0.45));
  overflow: hidden;
  color: var(--text-primary, #e6edf3);
}

.zel-cmd-palette__search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color, #30363d);
  flex-shrink: 0;
}

.zel-cmd-palette__search > .fa-magnifying-glass {
  color: var(--text-tertiary, #8b949e);
  font-size: 0.9rem;
}

/* Override global forms.css search icon/padding — palette already has a FA icon. */
.zel-cmd-palette__input,
.zel-cmd-palette__input[type='search'] {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding-left: 0.25rem;
  background: transparent;
  background-image: none;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 0;
  color: var(--text-primary, #e6edf3);
  font-size: 0.95rem;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

.zel-cmd-palette__input::placeholder {
  color: var(--text-tertiary, #8b949e);
}

.zel-cmd-palette__hint {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.zel-cmd-palette__body {
  overflow-y: auto;
  flex: 1;
  padding: 0.35rem 0 0.5rem;
}

.zel-cmd-palette__section {
  padding: 0.25rem 0 0.35rem;
}

.zel-cmd-palette__section-title {
  margin: 0;
  padding: 0.45rem 1rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary, #8b949e);
}

.zel-cmd-palette__item {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 1rem;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.zel-cmd-palette__item:hover,
.zel-cmd-palette__item.is-active {
  background: color-mix(in srgb, var(--accent-blue, #1f6feb) 14%, transparent);
}

.zel-cmd-palette__item.is-disabled {
  opacity: 0.55;
  cursor: default;
}

.zel-cmd-palette__item.is-disabled:hover,
.zel-cmd-palette__item.is-disabled.is-active {
  background: transparent;
}

.zel-cmd-palette__item-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bg-tertiary, #21262d);
  color: var(--accent-blue, #58a6ff);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.zel-cmd-palette__item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.zel-cmd-palette__item-title {
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.zel-cmd-palette__item-sub {
  font-size: 0.75rem;
  color: var(--text-secondary, #9ca3af);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zel-cmd-palette__badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: var(--bg-tertiary, #21262d);
  color: var(--text-tertiary, #8b949e);
}

.zel-cmd-palette__keys {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.zel-cmd-palette__kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  padding: 0.12rem 0.35rem;
  border: 1px solid var(--border-color, #30363d);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-tertiary, #21262d);
  color: var(--text-secondary, #9ca3af);
  font-size: 0.7rem;
  line-height: 1;
}

.zel-cmd-palette__chevron {
  color: var(--text-tertiary, #8b949e);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.zel-cmd-palette__empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-tertiary, #8b949e);
  font-size: 0.875rem;
}

.zel-cmd-palette__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border-color, #30363d);
  font-size: 0.7rem;
  color: var(--text-tertiary, #8b949e);
  flex-shrink: 0;
}

.zel-cmd-palette__footer span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
