html,
body {
  height: 100%;
}

body {
  overflow: hidden;
}

.app-shell {
  --surface: #1c1035;
  --text: #f4eaff;
  --muted: #bca7d8;
  --border: #4a2d78;
  --accent: #8f65d9;
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 20% 0%, #2a174b 0, transparent 38%), #130326;
  color: var(--text);
  overflow: hidden;
}

@supports (height: 100dvh) {
  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
  }
}

.app-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #1b1035;
  color: #f4eaff;
  border-bottom: 1px solid #3b225f;
  overflow: hidden;
}

.mobile-workspace-nav {
  display: none;
}

.company-topbar {
  justify-content: flex-end;
}

.app-workspace {
  display: grid;
  grid-template-columns: 18% 52% 30%;
  gap: 14px;
  padding: 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.nav-button,
.topbar-action {
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}

.app-shell button {
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  border-radius: 8px;
  padding: 8px 10px;
}

.app-shell button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.nav-button.active {
  border-color: #be95ff;
  background: #3e246e;
}

.logout {
  border-color: #7f1d1d;
  background: #2b1117;
}

.topbar-search {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-search-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.topbar-search-input-wrap {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-search-scope,
.topbar-search-input {
  border: 1px solid #5b3a8f;
  border-radius: 8px;
  background: #1d1036;
  color: #f4eaff;
  padding: 7px 10px;
  font: inherit;
}

.topbar-search-scope {
  min-width: 150px;
  flex: 0 0 150px;
}

.topbar-search-input {
  width: 100%;
  min-width: 0;
  padding-right: 38px;
}

.topbar-search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #f4eaff;
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.topbar-search-clear.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.topbar-profile-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  margin-left: auto;
  border-radius: 999px;
  border: 1px solid rgba(215, 197, 255, 0.36);
  background: rgba(69, 39, 111, 0.92);
  color: #f4eaff;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 0;
}

.topbar-profile-button-image,
.topbar-profile-summary-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.topbar-profile-button-initial,
.topbar-profile-summary-initial {
  display: grid;
  place-items: center;
  font-weight: 700;
}

.topbar-profile-button-initial {
  width: 100%;
  height: 100%;
  font-size: 18px;
}

.topbar-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 16px;
  display: none;
}

.topbar-profile-overlay.is-open {
  display: flex;
}

.topbar-profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.topbar-profile-dialog {
  position: relative;
  z-index: 1;
  width: min(340px, calc(100vw - 24px));
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(215, 197, 255, 0.22);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(28, 16, 53, 0.98), rgba(14, 8, 27, 0.96));
  box-shadow: 0 28px 68px rgba(3, 2, 10, 0.45);
}

.topbar-profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  display: grid;
  place-items: center;
  padding: 0;
}

.topbar-profile-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-right: 40px;
}

.topbar-profile-summary-avatar {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid rgba(215, 197, 255, 0.22);
  background: #f5eefc;
  color: #5b3a8f;
}

.topbar-profile-summary-initial {
  width: 100%;
  height: 100%;
  font-size: 24px;
}

.topbar-profile-summary-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.topbar-profile-name,
.topbar-profile-role {
  margin: 0;
}

.topbar-profile-name {
  font-size: 18px;
  line-height: 1.35;
  color: var(--text);
  word-break: break-word;
}

.topbar-profile-role {
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}

.topbar-profile-actions {
  display: grid;
  gap: 8px;
}

.topbar-profile-action {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.topbar-profile-action.is-danger {
  border-color: #7f1d1d;
  background: #2b1117;
}

.messages-shell {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.messages-shell.is-open {
  pointer-events: none;
}

.messages-panel {
  position: fixed;
  width: min(420px, calc(100vw - 16px));
  height: min(680px, calc(100vh - 80px));
  max-height: min(680px, calc(100vh - 80px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid #4a2d78;
  border-radius: 14px;
  background: #1c1035;
  box-shadow: 0 26px 60px rgba(3, 2, 10, 0.45);
  color: var(--text);
  pointer-events: auto;
  overflow: hidden;
}

.messages-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.messages-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  min-width: 0;
  flex: 1 1 auto;
}

.messages-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-back,
.messages-new,
.messages-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  display: grid;
  place-items: center;
  padding: 0;
}

.messages-back {
  display: none;
}

.messages-back.is-visible {
  display: grid;
}

.messages-close {
  margin-left: 0;
}

.messages-new {
  margin-left: auto;
}

.messages-search-input {
  width: 100%;
  border: 1px solid #5b3a8f;
  border-radius: 999px;
  background: #251246;
  color: #f4eaff;
  padding: 9px 12px;
  font: inherit;
}

.messages-list-view,
.messages-thread-view {
  min-height: 0;
  display: grid;
  gap: 10px;
}

.messages-list-view[hidden],
.messages-thread-view[hidden] {
  display: none !important;
}

.messages-list-view {
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
}

.messages-thread-view {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.messages-start-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.messages-start-select {
  border: 1px solid #5b3a8f;
  border-radius: 10px;
  background: #251246;
  color: #f4eaff;
  padding: 8px 10px;
  font: inherit;
  min-width: 0;
}

.messages-start-button {
  border-radius: 10px;
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  padding: 8px 12px;
}

.messages-tab-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.messages-tab {
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  white-space: nowrap;
  font-weight: 600;
}

.messages-tab.is-active {
  border-color: #be95ff;
  background: #3b225f;
  color: #f4eaff;
}

.messages-notice {
  margin: 0;
  border: 1px solid #4a2d78;
  background: #241246;
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 14px;
}

.messages-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding-right: 2px;
}

.messages-chat-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.messages-chat-row:hover {
  background: #2b174d;
}

.messages-chat-row.is-active {
  border-color: #6d47a6;
  background: #2d1851;
}

.messages-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--messages-avatar-color, #8f65d9);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.18);
}

.messages-chat-content {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.messages-chat-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.messages-chat-line h4 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-chat-line time {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.messages-chat-content p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a78bfa;
}

.messages-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 4px;
}

.messages-see-all {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  padding: 9px 12px;
}

.messages-thread-header {
  display: grid;
  gap: 4px;
}

.messages-thread-title {
  margin: 0;
  font-size: 18px;
}

.messages-thread-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.messages-thread-list {
  border: 1px solid #4a2d78;
  border-radius: 10px;
  background: #1b0f34;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.messages-thread-row {
  display: grid;
  gap: 4px;
}

.messages-thread-row.is-mine {
  justify-items: end;
}

.messages-thread-row-meta {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.messages-thread-bubble {
  max-width: 85%;
  border: 1px solid #5b3a8f;
  border-radius: 10px;
  background: #2f1d52;
  color: #f4eaff;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.messages-thread-attachment {
  display: grid;
  gap: 8px;
}

.messages-thread-attachment-kind {
  font-size: 12px;
  color: #d6c6f5;
}

.messages-thread-file-list {
  display: grid;
  gap: 8px;
}

.messages-thread-file-item {
  display: grid;
  gap: 6px;
}

.messages-thread-attachment-open {
  justify-self: start;
  border-radius: 8px;
  border: 1px solid #7b52b5;
  background: #3b225f;
  color: #f4eaff;
  padding: 6px 10px;
  font-size: 12px;
}

.messages-thread-image-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.messages-thread-image-grid.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.messages-thread-image {
  position: relative;
  min-width: 0;
  min-height: 120px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  padding: 0;
  cursor: pointer;
}

.messages-thread-image-media {
  width: 100%;
  height: 100%;
  min-height: 120px;
  display: block;
  object-fit: cover;
}

.messages-thread-image-grid.is-single .messages-thread-image,
.messages-thread-image-grid.is-single .messages-thread-image-media {
  min-height: 220px;
}

.messages-thread-image-fallback,
.messages-thread-image-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.messages-thread-image-fallback {
  color: #d6c6f5;
  font-size: 12px;
  background: linear-gradient(145deg, rgba(49, 33, 85, 0.88), rgba(26, 15, 52, 0.94));
}

.messages-thread-image-more {
  background: rgba(17, 10, 30, 0.58);
  color: #ffffff;
  font-size: 28px;
  font-weight: 700;
}

.messages-thread-caption {
  color: #f4eaff;
}

.messages-thread-row.is-mine .messages-thread-bubble {
  background: #43216f;
  border-color: #7b52b5;
}

.messages-thread-row.is-unreadable .messages-thread-bubble {
  background: rgba(73, 73, 88, 0.42);
  border-color: rgba(170, 170, 190, 0.38);
  color: #d7d7e6;
}

.messages-thread-unreadable {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
}

.messages-thread-unreadable-icon {
  font-size: 14px;
  line-height: 1;
}

.messages-thread-mode {
  margin: 0;
  color: #eab308;
  font-size: 12px;
}

.messages-thread-mode.has-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(61, 44, 6, 0.35);
}

.messages-thread-mode.has-banner.is-request {
  border-color: rgba(159, 122, 234, 0.4);
  background: rgba(75, 40, 119, 0.32);
  color: #f0defe;
}

.messages-thread-mode.has-banner.is-error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(95, 31, 43, 0.34);
  color: #ffd7df;
}

.messages-thread-mode-copy {
  min-width: 0;
}

.messages-thread-mode-action {
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(36, 20, 66, 0.88);
  color: #f4eaff;
  padding: 7px 12px;
  font-size: 12px;
}

.messages-thread-hint {
  display: grid;
  gap: 6px;
}

.messages-thread-retry {
  justify-self: start;
  border-radius: 8px;
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  padding: 6px 10px;
  font-size: 12px;
}

.messages-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: end;
}

.messages-compose-input {
  border: 1px solid #5b3a8f;
  border-radius: 10px;
  background: #251246;
  color: #f4eaff;
  padding: 8px 10px;
  font: inherit;
  resize: none;
}

.messages-send {
  border-radius: 10px;
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  padding: 9px 12px;
}

.messages-attach,
.messages-remove-attachment {
  border-radius: 10px;
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  padding: 9px 12px;
}

.messages-compose-pending {
  display: grid;
  gap: 8px;
  margin: 0;
  color: #d6c6f5;
  font-size: 12px;
}

.messages-compose-pending-status {
  color: #d6c6f5;
}

.messages-compose-pending-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.messages-compose-pending-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #4a2d78;
  border-radius: 10px;
  background: #231342;
  padding: 8px;
}

.messages-compose-pending-preview {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
}

.messages-compose-pending-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.messages-compose-pending-icon {
  color: #d6c6f5;
  font-size: 11px;
  text-align: center;
  padding: 6px;
}

.messages-compose-pending-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.messages-compose-pending-copy strong,
.messages-compose-pending-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-compose-pending-copy strong {
  color: #f4eaff;
  font-size: 12px;
}

.messages-compose-pending-copy span {
  color: #d6c6f5;
  font-size: 11px;
}

.messages-compose-pending-remove {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  padding: 0;
}

.messages-gallery-shell {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  background: rgba(8, 4, 16, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.messages-gallery-shell.is-open {
  opacity: 1;
  pointer-events: auto;
}

.messages-gallery-panel {
  width: min(1200px, calc(100vw - 24px));
  height: min(92vh, 900px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(215, 197, 255, 0.22);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(28, 16, 53, 0.96), rgba(10, 6, 20, 0.94));
  box-shadow: 0 34px 80px rgba(3, 2, 10, 0.5);
}

.messages-gallery-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.messages-gallery-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.messages-gallery-counter {
  margin: 0;
  color: #d6c6f5;
  font-size: 13px;
}

.messages-gallery-title {
  margin: 0;
  color: #f4eaff;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-gallery-close,
.messages-gallery-nav {
  border-radius: 999px;
  border: 1px solid rgba(215, 197, 255, 0.28);
  background: rgba(47, 29, 82, 0.84);
  color: #f4eaff;
}

.messages-gallery-close {
  margin-left: auto;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
}

.messages-gallery-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 0;
}

.messages-gallery-nav {
  width: 46px;
  height: 46px;
  padding: 0;
}

.messages-gallery-figure {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 0;
}

.messages-gallery-loading,
.messages-gallery-empty {
  place-self: center;
  color: #d6c6f5;
  font-size: 14px;
}

.messages-gallery-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.messages-gallery-caption {
  margin: 0;
  color: #f4eaff;
  text-align: center;
  font-size: 14px;
  line-height: 1.45;
}

.content {
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  min-height: 0;
}

.workspace-nav {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow: auto;
}

.workspace-title {
  margin: 0;
  font-size: 28px;
}

.workspace-nav-buttons {
  display: grid;
  gap: 10px;
}

.workspace-nav .nav-button {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
}

#table-panel.panel {
  padding: 14px;
  min-height: 0;
  overflow: auto;
}

.table-scroll {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.profile-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.profile-panel-content {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
}

.profile-mobile-header {
  display: none;
}

.profile-mobile-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.profile-mobile-back {
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  border-radius: 8px;
  padding: 8px 10px;
}

.profile-mobile-actions {
  display: none;
}

.profile-mobile-action {
  border: 1px solid #5b3a8f;
  background: #2f1d52;
  color: #f4eaff;
  border-radius: 8px;
  padding: 8px 10px;
  white-space: nowrap;
}

.profile-mobile-action.is-danger {
  border-color: #7f1d1d;
  background: #2b1117;
}

.profile-card {
  display: grid;
  gap: 8px;
}

.profile-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.profile-row {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 10px;
  align-items: start;
}

.profile-label {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.profile-value {
  color: var(--text);
  font-size: 17px;
  line-height: 1.35;
  word-break: break-word;
}

.profile-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 42px;
  background: #f5eefc;
  color: #5b3a8f;
}

.profile-section {
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.profile-section h4 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.profile-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.profile-button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #2f1d52;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  width: 100%;
}

.profile-timeline-title {
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.profile-timeline {
  display: grid;
  gap: 8px;
}

.profile-timeline-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #2f1d52;
  display: grid;
  gap: 6px;
}

.profile-timeline-item p {
  margin: 0;
}

.profile-empty {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.app-footer {
  text-align: center;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.panel-title {
  margin-bottom: 10px;
}

.panel.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.table-empty {
  margin: 8px 0 0;
  color: var(--muted);
}

.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  table-layout: auto;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px 10px;
  vertical-align: top;
  white-space: nowrap;
}

.data-table th {
  font-weight: 600;
  color: #f4eaff;
  background: #150a2a;
}

.interactive-table th[aria-sort="ascending"],
.interactive-table th[aria-sort="descending"] {
  background: #241042;
}

.table-sort-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.table-sort-button:disabled {
  cursor: default;
  opacity: 0.7;
}

.table-sort-button.is-active {
  color: #ffffff;
}

.table-sort-label {
  min-width: 0;
}

.table-sort-indicator {
  min-width: 14px;
  text-align: right;
  color: #d6c6f5;
}

.events-module {
  display: grid;
  gap: 12px;
}

.module-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  min-width: max-content;
}

.module-toolbar-left {
  display: grid;
  gap: 10px;
}

.module-toolbar-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.module-toolbar-actions > * {
  flex: 0 0 auto;
}

.module-toolbar-filters {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.module-toolbar-filters label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.module-toolbar-filters select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  min-width: 220px;
  color: var(--text);
  background: #241246;
}

.module-filter-number {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  width: 92px;
  color: var(--text);
  background: #241246;
}

.module-filter-search {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  min-width: 220px;
  color: var(--text);
  background: #241246;
}

.module-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.module-pagination-info {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.module-pagination-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.module-pagination-page {
  color: var(--muted);
  font-size: 13px;
  min-width: 64px;
  text-align: center;
}

.module-toolbar-actions .primary,
.dialog-footer .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.interactive-table tbody tr {
  cursor: pointer;
}

.interactive-table tbody tr.row-selected {
  background: #3c225f;
}

.interactive-table tbody tr.row-deleted {
  color: #b39bcf;
}

.interactive-table tbody tr.row-redeemed {
  background: #2b1949;
}

.interactive-table tbody tr.row-removed {
  color: #b39bcf;
  background: #2b1949;
}

.interactive-table tbody tr.row-locked {
  background: #3c2857;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.state-pill-active {
  color: #166534;
  background: #ecfdf3;
  border-color: #86efac;
}

.state-pill-redeemed {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #93c5fd;
}

.state-pill-locked {
  color: #92400e;
  background: #fffbeb;
  border-color: #fcd34d;
}

.state-pill-deleted {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

.state-pill-assigned {
  color: #166534;
  background: #ecfdf3;
  border-color: #86efac;
}

.state-pill-removed {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  display: grid;
  place-items: center;
  padding: 12px;
  z-index: 50;
}

.dialog {
  width: min(1100px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.dialog-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #2f1d52;
}

.dialog-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.dialog-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #9f1239;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid label,
.form-block {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--muted);
}

.form-block.is-hidden {
  display: none;
}

.form-grid input,
.form-grid select,
.form-block textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: #241246;
}

.form-grid-compact {
  grid-template-columns: 1fr 1fr;
}

.code-grid {
  align-items: end;
}

.code-actions {
  display: flex;
  align-items: center;
}

.code-actions button {
  min-height: 38px;
}

.role-editor {
  display: grid;
  gap: 8px;
}

.role-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: #241246;
}

.rules-dialog {
  width: min(880px, 100%);
}

.rules-content {
  display: grid;
  gap: 12px;
}

.rules-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #2f1d52;
  padding: 10px 12px;
}

.rules-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.rules-section p {
  margin: 0;
  white-space: pre-line;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.coordinator-field.is-hidden {
  display: none;
}

.ticket-types-editor {
  display: grid;
  gap: 8px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.compact-table input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  color: var(--text);
  background: #241246;
}

.compact-table td.actions-cell {
  width: 1%;
  white-space: nowrap;
}

.table-hint {
  margin: 0;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

@media (max-width: 900px) {
  .app-topbar {
    gap: 10px;
    padding: 10px;
  }

  .topbar-search-controls {
    gap: 6px;
  }

  .topbar-search-scope {
    min-width: 122px;
    flex-basis: 122px;
  }

  .topbar-profile-overlay {
    padding: 12px;
  }

  .topbar-profile-dialog {
    width: min(360px, calc(100vw - 24px));
  }

  .mobile-workspace-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #3b225f;
    background: #160b2c;
    overflow-x: auto;
  }

  .mobile-workspace-nav .nav-button {
    flex: 0 0 auto;
  }

  .app-workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .workspace-nav {
    display: none;
  }

  .content {
    gap: 10px;
  }

  .profile-panel {
    position: fixed;
    inset: 0;
    z-index: 140;
    border-radius: 0;
    border-width: 0;
    padding: 0;
    background: #1c1035;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }

  .profile-panel.is-mobile-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .profile-mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
  }

  .profile-panel-content {
    padding: 14px;
  }

  .profile-mobile-actions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 4px;
    position: sticky;
    top: 0;
    z-index: 1;
    background: #1c1035;
  }

  .messages-shell.is-open {
    pointer-events: auto;
    background: rgba(11, 6, 20, 0.78);
  }

  .messages-panel {
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    border-width: 0;
    box-shadow: none;
    padding: 14px;
  }

  @supports (height: 100dvh) {
    .messages-panel {
      height: 100dvh;
    }
  }

  .messages-back {
    display: grid;
  }

  .messages-close {
    display: none;
  }

  .messages-gallery-panel {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border-width: 0;
    padding: 14px;
  }

  .messages-gallery-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .messages-gallery-nav {
    width: 100%;
    height: 42px;
  }

  .messages-gallery-nav.is-prev {
    order: 1;
  }

  .messages-gallery-figure {
    order: 2;
  }

  .messages-gallery-nav.is-next {
    order: 3;
  }
}
