/* QBD Enterprise UI - visual-only layer. */
:root {
  --enterprise-sidebar: 252px;
  --enterprise-content: 1480px;
  --enterprise-header: 110px;
  --enterprise-bg: #030403;
  --enterprise-panel: #090a09;
  --enterprise-panel-raised: #0d0f0d;
  --enterprise-line: rgba(255, 255, 255, 0.1);
  --enterprise-line-soft: rgba(255, 255, 255, 0.055);
  --enterprise-muted: rgba(255, 255, 255, 0.58);
  --enterprise-muted-soft: rgba(255, 255, 255, 0.38);
  --enterprise-lime: #bade1b;
  --enterprise-lime-soft: rgba(186, 222, 27, 0.1);
  --enterprise-focus: 0 0 0 3px rgba(186, 222, 27, 0.17);
  --enterprise-shadow: 0 22px 60px rgba(0, 0, 0, 0.3);
}

html {
  background: var(--enterprise-bg);
  color-scheme: dark;
}

body {
  min-width: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    var(--enterprise-bg);
  background-size: 48px 48px;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 1px solid var(--enterprise-lime);
  outline-offset: 2px;
  box-shadow: var(--enterprise-focus);
}

::selection {
  color: #000;
  background: var(--enterprise-lime);
}

/* Desktop application frame */
@media (min-width: 901px) {
  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    display: grid;
    width: var(--enterprise-sidebar);
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    border: 0;
    border-right: 1px solid var(--enterprise-line);
    padding: 18px 14px 14px;
    overflow: hidden;
    background: rgba(4, 5, 4, 0.97);
    box-shadow: 18px 0 54px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(22px);
    animation: enterprise-sidebar-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .brand-box {
    width: 100%;
    min-width: 0;
    min-height: 68px;
    justify-content: flex-start;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid var(--enterprise-line-soft);
    padding: 0 8px 16px;
  }

  .brand-logo {
    width: 39px;
    height: 54px;
    flex: 0 0 39px;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(186, 222, 27, 0.12));
  }

  .brand-copy {
    display: grid;
    min-width: 0;
    gap: 4px;
  }

  .brand-copy strong {
    overflow: hidden;
    color: #fff;
    font-size: 0.78rem;
    letter-spacing: 0;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .brand-copy span {
    margin: 0;
    color: var(--enterprise-muted-soft);
    font-size: 0.58rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .menu-label {
    display: block;
    padding: 18px 10px 8px;
    color: var(--enterprise-muted-soft);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .nav {
    position: relative;
    display: block;
    min-width: 0;
    height: auto;
    min-height: 0;
    padding: 0 3px 16px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(186, 222, 27, 0.24) transparent;
    scrollbar-width: thin;
  }

  .nav::-webkit-scrollbar {
    display: block;
    width: 4px;
    height: 4px;
  }

  .nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(186, 222, 27, 0.26);
  }

  .nav-group {
    display: grid;
    gap: 4px;
    margin-top: 14px;
  }

  .nav-group:first-child {
    margin-top: 0;
  }

  .nav-group-label {
    display: block;
    padding: 0 9px 5px;
    color: var(--enterprise-muted-soft);
    font-size: 0.56rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
  }

  .nav button {
    position: relative;
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 6px 9px;
    color: var(--enterprise-muted);
    background: transparent;
    font-size: 0.7rem;
    text-align: left;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
  }

  .nav button:hover {
    border-color: var(--enterprise-line);
    color: #fff;
    background: rgba(255, 255, 255, 0.035);
    transform: translateX(2px);
  }

  .nav button.active {
    border-color: rgba(186, 222, 27, 0.38);
    color: #fff;
    background: linear-gradient(90deg, rgba(186, 222, 27, 0.14), rgba(186, 222, 27, 0.035));
    box-shadow: inset 3px 0 0 var(--enterprise-lime), 0 10px 28px rgba(0, 0, 0, 0.2);
  }

  .nav button.active::before,
  .nav button::after {
    display: none;
  }

  .nav-icon {
    width: 28px;
    height: 28px;
    border: 1px solid var(--enterprise-line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.025);
    font-size: 0.78rem;
  }

  .nav button.active .nav-icon {
    border-color: rgba(186, 222, 27, 0.5);
    color: var(--enterprise-lime);
    background: rgba(186, 222, 27, 0.1);
  }

  .user-box {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin: 0;
    border: 1px solid var(--enterprise-line);
    border-radius: 7px;
    padding: 10px;
    background: var(--enterprise-panel);
  }

  .user-box .user-mini {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .user-box .avatar {
    width: 34px;
    height: 34px;
  }

  .user-box .btn {
    width: 100%;
    min-width: 0;
    min-height: 34px;
  }

  .workspace {
    width: auto;
    min-height: 100dvh;
    margin-left: var(--enterprise-sidebar);
    padding: 0 0 72px;
  }

  .mobile-top {
    display: none !important;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    min-height: var(--enterprise-header);
    align-items: center;
    gap: 28px;
    border-bottom: 1px solid var(--enterprise-line);
    padding: 18px max(28px, calc((100vw - var(--enterprise-sidebar) - var(--enterprise-content)) / 2));
    background: rgba(3, 4, 3, 0.88);
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(24px) saturate(120%);
  }

  .content-grid {
    width: min(var(--enterprise-content), calc(100% - 56px));
    padding-top: 28px;
  }
}

/* Shared product surfaces */
.topbar,
.panel,
.form-section,
.modal-card,
.drawer-content,
.permission-role-card,
.vote-card,
.metric,
.stat-card,
.task-card,
.team-user-row,
.team-role-row {
  letter-spacing: 0;
}

.view-title-icon {
  border-radius: 7px;
  box-shadow: none;
}

.view-title h1 {
  letter-spacing: 0;
}

.toolbar {
  flex-wrap: wrap;
}

.btn {
  border-radius: 6px;
  box-shadow: none;
  transition: transform 150ms ease, color 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn.primary {
  border-color: var(--enterprise-lime);
  color: #000;
  background: var(--enterprise-lime);
  box-shadow: 0 10px 26px rgba(186, 222, 27, 0.12);
}

.btn.primary:hover:not(:disabled) {
  color: #000;
  background: #c6ea22;
  box-shadow: 0 14px 34px rgba(186, 222, 27, 0.18);
}

.btn.ghost,
.btn.secondary {
  border-color: var(--enterprise-line);
  color: #fff;
  background: #090a09;
}

.btn.ghost:hover:not(:disabled),
.btn.secondary:hover:not(:disabled) {
  border-color: rgba(186, 222, 27, 0.34);
  background: rgba(186, 222, 27, 0.06);
}

.panel,
.form-section,
.modal-card,
.permission-role-card,
.notice-recipient-picker,
.performance-kpi,
.stat-card,
.metric,
.vote-card,
.task-card,
.drawer-section {
  border-color: var(--enterprise-line);
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.018), transparent 52%), var(--enterprise-panel);
  box-shadow: var(--enterprise-shadow);
}

.panel::before,
.form-section::before,
.metric::before,
.vote-card::before {
  height: 2px;
  background: var(--enterprise-lime);
  box-shadow: none;
}

.panel-header {
  border-bottom-color: var(--enterprise-line-soft);
}

.panel-header h2,
.panel-header h3 {
  color: #fff;
}

.panel-header p,
.cell-muted,
.help-text,
.permission-note {
  color: var(--enterprise-muted);
}

input,
select,
textarea {
  border-color: var(--enterprise-line);
  border-radius: 6px;
  color: #fff;
  background: #050605;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--enterprise-lime);
  box-shadow: var(--enterprise-focus);
}

.filter-panel,
.filters,
.table-shell {
  border-color: var(--enterprise-line);
  border-radius: 7px;
  background: rgba(8, 9, 8, 0.92);
}

.filter-tabs {
  border-radius: 6px;
}

.filter-tabs button {
  border-radius: 5px;
}

.filter-tabs button.active,
.filter-pill.active {
  color: #000;
  background: var(--enterprise-lime);
}

table {
  border-collapse: separate;
  border-spacing: 0 7px;
}

thead th {
  color: var(--enterprise-muted-soft);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

tbody tr {
  background: #070807;
  transition: background 150ms ease, transform 150ms ease;
}

tbody tr:hover {
  background: #0c0e0c;
}

tbody td:first-child {
  border-radius: 6px 0 0 6px;
}

tbody td:last-child {
  border-radius: 0 6px 6px 0;
}

.status-pill,
.priority,
.chip,
.result-count {
  border-radius: 999px;
  letter-spacing: 0;
}

.empty-state {
  border-color: var(--enterprise-line);
  border-radius: 7px;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.015) 0 10px, transparent 10px 20px), #060706;
}

.drawer {
  backdrop-filter: blur(8px);
}

.drawer-content {
  border-left-color: rgba(186, 222, 27, 0.42);
  background: #050605;
  box-shadow: -28px 0 72px rgba(0, 0, 0, 0.55);
}

.drawer-header,
.modal-head {
  border-bottom: 1px solid var(--enterprise-line);
}

.modal-backdrop,
.drawer-backdrop,
.role-modal-backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
}

.toast {
  border-color: rgba(186, 222, 27, 0.5);
  border-radius: 7px;
  background: rgba(6, 8, 6, 0.96);
  box-shadow: inset 3px 0 0 var(--enterprise-lime), 0 22px 58px rgba(0, 0, 0, 0.5);
}

.voting-deadline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 18px;
  margin: 16px 0;
  border: 1px solid rgba(186, 222, 27, 0.3);
  border-radius: 7px;
  padding: 14px 16px;
  background: rgba(186, 222, 27, 0.055);
  box-shadow: inset 3px 0 0 var(--enterprise-lime);
}

.voting-deadline > div {
  display: grid;
  gap: 3px;
}

.voting-deadline span,
.voting-deadline small {
  color: var(--enterprise-muted);
}

.voting-deadline > strong {
  color: var(--enterprise-lime);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.voting-deadline small {
  grid-column: 1 / -1;
}

/* Mobile keeps every route reachable through a horizontally scrollable dock. */
@media (max-width: 900px) {
  :root {
    --enterprise-mobile-top: 62px;
    --enterprise-mobile-nav: 82px;
  }

  body {
    background-size: 36px 36px;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
    padding: var(--enterprise-mobile-top) 0 calc(var(--enterprise-mobile-nav) + 24px);
  }

  .mobile-top {
    position: fixed;
    inset: 0 0 auto;
    z-index: 105;
    display: grid;
    height: var(--enterprise-mobile-top);
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    border-bottom: 1px solid var(--enterprise-line);
    padding: 7px 14px;
    background: rgba(4, 5, 4, 0.95);
    backdrop-filter: blur(20px);
  }

  .mobile-brand-logo {
    width: 30px;
    height: 44px;
  }

  .mobile-brand-copy {
    min-width: 0;
  }

  .mobile-brand-copy strong,
  .mobile-brand-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar {
    position: fixed;
    inset: auto 10px 10px;
    z-index: 110;
    display: block;
    width: auto;
    height: var(--enterprise-mobile-nav);
    min-height: 0;
    border: 1px solid var(--enterprise-line);
    border-radius: 8px;
    padding: 7px;
    overflow: hidden;
    background: rgba(4, 5, 4, 0.97);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(22px);
  }

  .sidebar .brand-box,
  .sidebar .menu-label,
  .sidebar .user-box,
  .nav-group-label {
    display: none !important;
  }

  .nav {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: stretch;
    gap: 6px;
    padding: 0 2px 3px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(186, 222, 27, 0.38) transparent;
    touch-action: pan-x;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .nav::-webkit-scrollbar {
    display: block;
    height: 3px;
  }

  .nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(186, 222, 27, 0.4);
  }

  .nav-group {
    display: contents;
  }

  .nav button {
    position: relative;
    display: grid;
    min-width: 78px;
    height: 66px;
    flex: 0 0 78px;
    grid-template-columns: 1fr;
    grid-template-rows: 30px minmax(0, 1fr);
    justify-items: center;
    gap: 4px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 6px 5px;
    color: var(--enterprise-muted);
    background: transparent;
    font-size: 0.59rem;
    line-height: 1.1;
    text-align: center;
  }

  .nav button.active {
    border-color: rgba(186, 222, 27, 0.46);
    color: #fff;
    background: rgba(186, 222, 27, 0.1);
    box-shadow: inset 0 -3px 0 var(--enterprise-lime);
  }

  .nav button::before,
  .nav button::after {
    display: none;
  }

  .nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }

  .nav-notification {
    position: absolute;
    top: 3px;
    right: 5px;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    min-height: calc(100dvh - var(--enterprise-mobile-top));
    margin: 0;
    padding: 0 0 24px;
  }

  .topbar {
    position: relative;
    top: auto;
    z-index: 1;
    min-height: 0;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 16px 18px;
    background: rgba(3, 4, 3, 0.8);
  }

  .view-title {
    align-items: flex-start;
  }

  .view-title-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .view-title h1 {
    font-size: 1.48rem;
    line-height: 1.08;
  }

  .view-title p {
    font-size: 0.75rem;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 7px;
    padding-bottom: 3px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .toolbar::-webkit-scrollbar {
    display: none;
  }

  .toolbar > * {
    min-width: max-content;
    flex: 0 0 auto;
  }

  .analyst-pill {
    max-width: 220px;
  }

  .analyst-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .content-grid,
  .content-grid.split {
    width: calc(100% - 24px);
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
    padding-top: 14px;
  }

  .panel,
  .form-section,
  .vote-card,
  .task-card {
    border-radius: 7px;
    padding: 16px;
  }

  .form-grid,
  .vote-case-grid,
  .task-meta,
  .integration-origin-grid,
  .team-view,
  .metrics-grid,
  .stats-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .table-shell {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }

  .drawer-content,
  .modal-card,
  .role-modal-card {
    width: min(100%, 100vw);
    max-width: 100vw;
    border-radius: 0;
  }

  .voting-deadline {
    grid-template-columns: minmax(0, 1fr);
  }

  .voting-deadline small {
    grid-column: auto;
  }
}

@media (max-width: 540px) {
  .mobile-brand-copy span,
  .mobile-top .user-mini > div,
  .analyst-pill {
    display: none;
  }

  .mobile-top {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .toolbar .btn {
    min-height: 40px;
    padding-inline: 11px;
  }

  .toolbar .btn span:not(.btn-icon) {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes enterprise-sidebar-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
