[data-bs-theme="dark"] {
  --bs-body-bg: #1d2128;
  --bs-body-color: #e4e9f0;
  --bs-body-color-rgb: 228, 233, 240;
  --bs-secondary-color: #a4afbe;
  --bs-secondary-bg: #252b35;
  --bs-tertiary-bg: #272e39;
  --bs-tertiary-bg-rgb: 39, 46, 57;
  --bs-border-color: #333b47;
  --bs-primary-bg-subtle: #25354e;
  --bs-primary-text-emphasis: #a6c8ff;
  --bs-link-color-rgb: 156, 195, 255;
  --bs-link-hover-color-rgb: 202, 222, 255;
}
.portal-body, .portal-auth { background: #15181d; }
.portal-body { font-size: .9375rem; }
.portal-layout { min-height: 100vh; }
.portal-main, .changelist-form-container { min-width: 0; }
.portal-topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 24px;
  background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color);
}
.portal-content { padding: 24px; }
.portal-location { color: var(--bs-body-color); font-size: .875rem; }
.portal-topbar .dropdown-toggle {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--bs-tertiary-bg);
  --bs-btn-hover-border-color: var(--bs-border-color);
}
.portal-topbar .ti-user-circle { font-size: 1.25rem; vertical-align: middle; }
.portal-sidebar {
  --bs-offcanvas-width: 268px;
  --bs-offcanvas-bg: var(--bs-body-bg);
  overflow-y: auto;
}
.portal-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; min-height: 60px; border-bottom: 1px solid var(--bs-border-color); }
.portal-sidebar nav { padding-top: 14px; }
.portal-brand {
  display: inline-flex; align-items: center; gap: 10px; font-size: 1.25rem;
  color: var(--bs-body-color); font-weight: 650; text-decoration: none;
}
.portal-brand-icon {
  display: grid; place-items: center; width: 36px; height: 36px;
  background: var(--bs-primary); color: white; border-radius: var(--bs-border-radius-lg);
}
.side-nav { list-style: none; margin: 0 0 18px; padding: 0 12px; }
.side-nav-title { padding: 6px 10px; font-size: .8rem; font-weight: 600; color: var(--bs-secondary-color); }
.side-nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  color: #bfc9d7; border-radius: .25rem; text-decoration: none;
}
.side-nav-link:hover { background: var(--bs-tertiary-bg); }
.side-nav-link.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
@media (min-width: 992px) {
  .portal-layout:not(.portal-popup) { display: grid; grid-template-columns: 248px minmax(0,1fr); }
  .portal-sidebar {
    position: sticky; top: 0; height: 100vh;
    border-right: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg) !important;
  }
}
.portal-title { font-size: 1.5rem; font-weight: 550; margin: 0 0 18px; }
.dashboard-grid { display: grid; gap: 16px; align-items: start; }
.dashboard-column { display: grid; gap: 16px; }
.dashboard-card { padding: 16px; min-width: 0; border-color: transparent; border-radius: .625rem; }
.dashboard-heading { display: flex; justify-content: space-between; gap: 8px 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.dashboard-heading h2 { display: flex; align-items: center; gap: 8px; font-size: 1rem; margin: 0; }
.dashboard-heading a { font-size: .8125rem; text-decoration: none; }
.dashboard-heading a:hover { text-decoration: underline; }
.dashboard-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: .5rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis);
}
.dashboard-metrics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.dashboard-stat { background: var(--bs-secondary-bg); padding: 8px 10px; border-radius: .5rem; }
.dashboard-stat-value { color: #94bbff; font-size: 1.4rem; font-weight: 650; line-height: 1.2; }
.dashboard-stat-label, .dashboard-stat-detail, .dashboard-subheading { color: var(--bs-secondary-color); font-size: .8125rem; }
.dashboard-stat-detail { margin-top: 2px; }
.dashboard-subheading { margin: 16px 0 8px; }
.dashboard-type { margin-bottom: 12px; }
.dashboard-type:last-child { margin-bottom: 0; }
.dashboard-type .progress { height: 5px; }
.dashboard-action { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--bs-border-color); }
.dashboard-action:last-child { border-bottom: 0; }
@media (min-width: 700px) { .dashboard-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1280px) { .dashboard-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.volume-chart { display: flex; gap: 6px; padding-top: 14px; }
.volume-column { min-width: 0; flex: 1; text-align: center; }
.volume-track { height: 155px; display: flex; align-items: flex-end; justify-content: center; background: repeating-linear-gradient(to top,var(--bs-border-color) 0 1px, transparent 1px 38px); }
.volume-bar { position: relative; width: min(55%,52px); min-height: 1px; background: #72a7f9; border-radius: 4px 4px 0 0; }
.volume-bar span { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); font-size: .8rem; }
.volume-column time { display: block; margin-top: 6px; font-size: .8rem; }
.collection-header, .object-tools, .actions, .submit-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
}
.collection-header { justify-content: space-between; margin-bottom: 16px; }
.collection-header .portal-title { font-size: 1.25rem; }
.collection-header .portal-title, .collection-header .object-tools { margin: 0; }
.breadcrumbs { margin: 0 0 14px; }
.collection-panel { padding: 16px; background: var(--bs-body-bg); border-radius: .375rem; }
.collection-toolbar, #changelist-filter, .collection-search {
  display: flex; flex-wrap: wrap; align-items: end; gap: 8px;
}
.collection-toolbar { margin-bottom: 12px; }
#changelist-filter, .collection-search { flex: 1 1 260px; min-width: 0; }
.collection-filter, .collection-search-field { flex: 1 1 130px; min-width: 0; }
.collection-search-field { flex-basis: 180px; }
.collection-label { display: block; margin-bottom: 8px; font-size: .8rem; }
.collection-filter-toggle {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  --bs-btn-bg: var(--bs-secondary-bg);
  --bs-btn-border-color: var(--bs-border-color);
  --bs-btn-hover-bg: var(--bs-tertiary-bg);
  --bs-btn-hover-border-color: var(--bs-border-color);
  --bs-btn-active-bg: var(--bs-tertiary-bg);
  --bs-btn-active-border-color: var(--bs-border-color);
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-hover-color: var(--bs-body-color);
  --bs-btn-active-color: var(--bs-body-color);
}
.collection-filter-toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-filter .dropdown-menu { max-height: 45vh; max-width: min(90vw, 24rem); overflow: auto; }
.collection-filter .dropdown-item { white-space: normal; overflow-wrap: anywhere; }
#content .collection-search #searchbar {
  width: 100%; min-height: 38px; padding-block: 6px; background: var(--bs-secondary-bg);
}
.collection-reset { min-width: 40px; }
.collection-status { color: var(--bs-secondary-color); font-size: .8125rem; }
.collection-status { margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.collection-empty { padding: 16px 8px; border-top: 1px solid var(--bs-border-color); }
#result_list a, .object-tools a, .field-index a { text-decoration: none; }
#result_list a:hover { text-decoration: underline; }
#result_list :is(th, td), .collection-table :is(th, td) {
  padding: 8px; border-bottom: 1px solid var(--bs-border-color);
}
#result_list thead th, .collection-table thead th { white-space: nowrap; }
#result_list thead a { color: inherit; }
#result_list thead .sortable:not(.sorted) .text a::after {
  content: "↕"; margin-inline-start: .5em; color: var(--bs-secondary-color);
}
#result_list .sortoptions { float: right; display: flex; gap: 6px; margin-inline-start: 8px; }
#result_list tbody :is(td, th) { vertical-align: middle; overflow-wrap: anywhere; }
#result_list tbody th { font-weight: 500; }
#result_list :is(.field-sent_at, .field-action_date, .field-chat_id, .field-thread_id) {
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
#result_list .field-preview { min-width: 12rem; }
#result_list tbody .field-sent_at a { color: var(--bs-body-color); }
#result_list tbody tr:nth-child(odd), .collection-table { --bs-table-striped-bg: var(--bs-secondary-bg); }
#result_list tbody tr:nth-child(odd) { background: var(--bs-table-striped-bg); }
#result_list tbody tr:hover { background: var(--bs-tertiary-bg); }
#result_list .action-checkbox, #result_list .action-checkbox-column { width: 1%; }
fieldset.module, .submit-row, #content-related .module {
  background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius-lg);
  padding: 20px;
}
.results, .table-responsive { overflow-x: auto; }
#result_list, .module table, #change-history { width: 100%; }
#change-history :is(td, th) { padding: 8px; border-bottom: 1px solid var(--bs-border-color); }
.object-tools { padding: 0; list-style: none; }
.object-tools:empty { display: none; }
.object-tools a, #content button.button, #content input[type=submit], .submit-row a {
  display: inline-block; padding: 7px 14px; border: 0; border-radius: 5px; color: #fff!important; background: var(--bs-primary); text-decoration: none;
}
#content :is(input[type=text],input[type=number],input[type=email],input[type=password],input[type=search],input[type=url],select,textarea) {
  padding: 8px 10px; max-width: 100%; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); background: var(--bs-body-bg); color: var(--bs-body-color);
}
#content :is(input,select,textarea):focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.actions { margin-bottom: 12px; }
fieldset.module h2 { font-size: 1.1rem; }
.field-index { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.field-index a { background: var(--bs-primary-bg-subtle); padding: 6px 12px; border-radius: 5px; }
fieldset.module { min-width: 0; margin-bottom: 18px; }
.form-row { padding: 12px 0; }
.form-row + .form-row { border-top: 1px solid var(--bs-border-color); }
.form-row .flex-container:not(.checkbox-row) { display: grid; gap: 5px; }
.form-row :is(textarea,input[type=text],input[type=url],input[type=password],select) { width: min(100%,660px); }
.help, .helptext, .quiet, .action-counter { color: var(--bs-secondary-color); font-size: .875rem; }
.readonly { white-space: pre-wrap; overflow-wrap: anywhere; }
.errorlist, .errornote { color: var(--bs-danger-text-emphasis); }
.hidden, [hidden], .clear { display: none!important; }
.sortremove::before { content: "×"; }
.sortoptions .ascending::before { content: "↑"; }
.sortoptions .descending::before { content: "↓"; }
.portal-auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.portal-auth-panel { width: min(100%,440px); }
.portal-auth .card-body { padding: clamp(24px, 4vw, 40px); }
@media (max-width: 620px) {
  .portal-content, .portal-topbar { padding-inline: 14px; }
  .collection-header, .actions { align-items: flex-start; }
  .collection-panel { padding: 12px; }
}

.collection-utilities, .collection-period {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.collection-utilities { margin-bottom: 14px; }
.collection-utilities:empty { display: none; }
.collection-facet-toggle { margin-inline-start: auto; }
.collection-utility {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: var(--bs-border-color);
  --bs-btn-bg: var(--bs-secondary-bg);
  --bs-btn-hover-bg: var(--bs-tertiary-bg);
  --bs-btn-hover-border-color: var(--bs-secondary-color);
}
.collection-utility.is-active, .collection-period-current {
  color: var(--bs-primary-text-emphasis); background: var(--bs-primary-bg-subtle);
}
.collection-period-current { padding: .25rem .5rem; border-radius: var(--bs-border-radius); font-size: .875rem; }
.collection-period .dropdown-menu { max-height: 40vh; overflow: auto; }
.collection-pagination { display: flex; justify-content: center; margin-top: 16px; }
.collection-pagination .pagination {
  flex-wrap: wrap;
  --bs-pagination-bg: var(--bs-body-bg);
  --bs-pagination-color: var(--bs-primary-text-emphasis);
  --bs-pagination-border-color: var(--bs-border-color);
  --bs-pagination-disabled-bg: var(--bs-body-bg);
  --bs-pagination-disabled-color: var(--bs-secondary-color);
  --bs-pagination-disabled-border-color: var(--bs-border-color);
  --bs-pagination-active-bg: var(--bs-primary);
  --bs-pagination-active-border-color: var(--bs-primary);
}
.collection-pagination .page-link { min-width: 34px; padding: 6px 8px; text-align: center; }

.group-panel-button { margin: 2px 0; white-space: nowrap; }
#result_list .field-group_buttons { min-width: 20rem; }
.group-chat-stream {
  display: grid; justify-items: start; align-content: start; gap: 8px;
  max-height: 55vh; overflow-y: auto; padding: 12px;
  background: #15181d; border: 1px solid var(--bs-border-color); border-radius: .5rem;
}
.group-chat-bubble { max-width: min(100%, 48rem); padding: 8px 12px; background: var(--bs-secondary-bg); border-radius: .65rem; }
.group-chat-bubble header { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; margin-bottom: 4px; }
.group-chat-bubble strong { color: var(--bs-primary-text-emphasis); }
.group-chat-bubble time { color: var(--bs-secondary-color); font-size: .8rem; }
.group-chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.group-chat-text blockquote { margin: .5em 0; padding-inline-start: .75em; border-inline-start: 3px solid var(--bs-primary); }
.group-chat-text tg-spoiler { background: var(--bs-secondary-color); color: var(--bs-body-bg); padding: 0 .25em; }
.group-emoji-menu.show { display: grid; grid-template-columns: repeat(4, minmax(2rem, 1fr)); }
.group-settings-form { max-width: 48rem; }
.group-settings-form > div { margin-bottom: 14px; }
.group-settings-form > div > label { display: block; margin-bottom: 4px; }
.group-settings-form :is(input:not([type=checkbox]),select,textarea) {
  width: 100%; padding: .45rem .65rem; color: var(--bs-body-color); background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius);
}
.group-settings-form textarea { min-height: 5rem; }
.journal-media { max-width: min(100%, 28rem); max-height: 360px; border-radius: .5rem; display: block; }
