.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

header {
  align-items: center;
  padding: 11px 42px;
}

.brand {
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: .1em;
  text-decoration: none;
  text-transform: uppercase;
}

.header-side { align-items: center; gap: 22px; }
.nav-tab { display: inline-flex; align-items: center; padding: 7px 10px; text-decoration: none; }
.status { margin-bottom: 0; }

.filters {
  /* The period holds two dates and gets a fixed width that fits them; short-valued fields take less room. */
  grid-template-columns: 330px minmax(180px, .7fr) minmax(260px, 1.4fr) minmax(190px, .6fr) auto auto;
  margin-bottom: 14px;
  position: relative;
  z-index: 10;
}

.filter-field {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 6px;
}

.filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.filters .filter-trigger,
.date-range-input-wrap {
  display: flex;
  width: 100%;
  height: 44px;
  min-width: 0;
  padding: 0 10px;
  align-items: center;
  gap: 8px;
  border: 1px solid #d6dde2;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.filters > button { height: 44px; }

.date-range-input-wrap > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-range-input-wrap > svg:first-child { color: var(--brand); }

.date-pair {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.date-pair .date-range-input-wrap { flex: 1 1 0; min-width: 0; }

.date-pair-separator { color: var(--muted); }

.filters .date-picker-input {
  height: 40px;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-weight: 650;
  cursor: pointer;
  pointer-events: none;
}

.filter-trigger > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-trigger svg,
.popover-icon-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-trigger > svg:first-child { color: var(--brand); }
.filter-chevron { margin-left: auto; color: #7f8c97 !important; }

.filter-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  left: 0;
  border: 1px solid #d8e0e4;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 38px #17202a2b;
}

.filter-popover[hidden] { display: none; }

.account-popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.air-datepicker {
  --adp-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --adp-font-size: 13px;
  --adp-accent-color: var(--brand);
  --adp-color-current-date: var(--brand);
  --adp-day-name-color: var(--brand);
  --adp-cell-background-color-selected: var(--brand);
  --adp-cell-background-color-selected-hover: #2a4a73;
  --adp-cell-background-color-in-range: var(--brand-soft);
  --adp-cell-background-color-in-range-hover: #dfe6ef;
  z-index: 60;
  border-color: #d8e0e4;
  border-radius: 10px;
  box-shadow: 0 16px 38px #17202a2b;
}

.air-datepicker-nav--title { font-weight: 750; }
.air-datepicker-nav--title i { color: var(--brand); }

.filters .popover-text-button,
.filters .popover-primary-button {
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.popover-text-button { border: 0; background: transparent; color: var(--brand); }
.popover-primary-button { border: 0; background: var(--brand); color: #fff; }
.popover-primary-button:disabled { opacity: .45; cursor: default; }

.account-popover { right: 0; left: auto; width: min(390px, calc(100vw - 36px)); padding: 7px; }
.account-options { display: grid; max-height: 280px; overflow-y: auto; }

.account-option {
  display: flex !important;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  align-items: center;
  grid-template-columns: none !important;
  gap: 9px !important;
  border-radius: 6px;
  color: var(--ink) !important;
  cursor: pointer;
}

.account-option:hover { background: #f4f6f9; }
.account-option-all { margin-bottom: 4px; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; font-weight: 750; }
.account-option input { width: 16px !important; height: 16px !important; flex: 0 0 16px; margin: 0; accent-color: var(--brand); }
.account-option span { display: grid; min-width: 0; }
.account-option strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-option small { color: var(--muted); font: 10px ui-monospace,SFMono-Regular,Menlo,monospace; }
.account-empty { padding: 16px 8px; color: var(--muted); font-size: 12px; text-align: center; }
.account-popover-footer { margin: 5px 0 0; padding: 7px 2px 0; }

.dimension-order-control,
.tag-filter-control {
  position: relative;
  min-width: 0;
}

.dimension-order-control > summary,
.tag-filter-control > summary {
  list-style: none;
  cursor: pointer;
}

.dimension-order-control > summary::-webkit-details-marker,
.tag-filter-control > summary::-webkit-details-marker { display: none; }

.dimension-order-control[open] > summary,
.tag-filter-control[open] > summary {
  border-color: #a8b7cb;
  box-shadow: 0 0 0 2px #34598a14;
}

.dimension-order-control[open] > summary .filter-chevron,
.tag-filter-control[open] > summary .filter-chevron { transform: rotate(180deg); }

.dimension-order-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--ink);
}

.dimension-reset {
  height: auto !important;
  padding: 2px 4px !important;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 11px;
}

.dimension-order-popover {
  width: min(760px, calc(100vw - 36px));
  padding: 12px;
}

.dimension-order-help {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.tag-filter-popover {
  right: 0;
  left: auto;
  width: min(650px, calc(100vw - 36px));
  padding: 12px;
}

.tag-filter-heading,
.tag-filter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tag-filter-heading { margin-bottom: 10px; }
.tag-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tag-filter-grid label { color: var(--muted); font-size: 11px; }
.tag-filter-grid input { height: 34px; font-size: 12px; }
.tag-filter-footer { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.tag-filter-footer span { color: var(--muted); font-size: 11px; font-weight: 500; }

.sort-button {
  display: inline-flex;
  min-height: 24px;
  padding: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

th:first-child .sort-button { justify-content: flex-start; }
.sort-button span { min-width: 10px; color: var(--brand); font-size: 13px; }
.sort-button:hover { color: var(--ink); }
.sort-button:focus-visible { border-radius: 4px; outline: 2px solid var(--brand); outline-offset: 2px; }

.dimension-reset:disabled {
  color: #a6afb7;
  cursor: default;
}

.dimension-order {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border: 1px solid #d6dde2;
  border-radius: 8px;
  background: #f8fafb;
}

.dimension-token {
  position: relative;
  min-width: max-content;
  border: 1px solid #dbe2e6;
  border-radius: 7px;
  background: #fff;
  transition: border-color .14s ease, box-shadow .14s ease, opacity .14s ease;
}

.dimension-token:hover,
.dimension-token:focus-within {
  border-color: #a8b7cb;
  box-shadow: 0 2px 6px #22324a12;
}

.dimension-token.dragging {
  opacity: .4;
}

.dimension-token.drop-before::before,
.dimension-token.drop-after::after {
  position: absolute;
  z-index: 3;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 999px;
  background: var(--brand);
  content: "";
}

.dimension-token.drop-before::before { left: -5px; }
.dimension-token.drop-after::after { right: -5px; }

.dimension-order .dimension-handle {
  display: flex;
  width: auto;
  height: 36px;
  padding: 0 8px;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: grab;
  text-align: left;
  touch-action: pan-y;
  user-select: none;
}

.dimension-order .dimension-handle:active { cursor: grabbing; }
.dimension-order .dimension-handle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.dimension-grip {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: #7f8c97;
  stroke-width: 2;
  stroke-linecap: round;
}

.dimension-position {
  display: inline-flex;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
}

.dimension-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dimension-menu-indicator {
  margin-left: 1px;
  color: #7f8c97;
  font-size: 14px;
  line-height: 1;
}

.dimension-actions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  left: 0;
  display: grid;
  min-width: 150px;
  padding: 5px;
  border: 1px solid #d8e0e4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px #17202a24;
}

.dimension-actions[hidden] { display: none; }

.dimension-actions button {
  height: 31px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.dimension-actions button:hover,
.dimension-actions button:focus-visible {
  background: var(--brand-soft);
  outline: none;
}

.dimension-actions button:disabled {
  color: #a6afb7;
  cursor: default;
  background: transparent;
}

.tree-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tree-toggle {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #3d5370;
  cursor: pointer;
}

.tree-toggle:hover {
  background: var(--brand-soft);
}

.tree-toggle:disabled {
  cursor: wait;
  opacity: .65;
}

.tree-chevron {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .16s ease;
}

.tree-toggle.expanded .tree-chevron {
  transform: rotate(90deg);
}

.tree-toggle.loading .tree-chevron {
  animation: tree-pulse .8s ease-in-out infinite alternate;
}

@keyframes tree-pulse {
  to { opacity: .25; }
}

.tree-leaf {
  display: inline-block;
  width: 24px;
  flex: 0 0 24px;
}

.tree-label {
  color: #30547f;
}

.tree-level-0 .tree-label {
  font-weight: 800;
}

.tree-level-1 .tree-cell { padding-left: 14px; }
.tree-level-2 .tree-cell { padding-left: 28px; }
.tree-level-3 .tree-cell { padding-left: 42px; }
.tree-level-4 .tree-cell { padding-left: 56px; }
.tree-level-5 .tree-cell { padding-left: 70px; }

.tree-error td {
  padding-left: 54px !important;
  background: #fff5f3 !important;
  color: var(--danger);
  text-align: left !important;
}

@media (max-width: 1400px) {
  .filters { grid-template-columns: minmax(330px, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
  .tag-filter-field { grid-column: span 1; }
  .filters > button { width: 100%; }
}

@media (max-width: 1000px) {
  header { align-items: center; }
  .header-side { align-items: center; flex-direction: row; }
  .status { display: none; }
}

@media (max-width: 900px) {
  header { align-items: center; padding: 10px 18px; }
  .header-side { align-items: center; flex-direction: row; }
  .status { display: none; }
  .filters { grid-template-columns: minmax(300px, 1fr) minmax(0, 1fr); }
  .dimension-order-field,
  .tag-filter-field { grid-column: 1 / -1; }
  .dimension-token.drop-before::before,
  .dimension-token.drop-after::after {
    top: 4px;
    right: auto;
    bottom: 4px;
    left: -4px;
    width: 3px;
    height: auto;
  }
  .dimension-token.drop-before::before { left: -4px; }
  .dimension-token.drop-after::after { right: -4px; left: auto; }
  .tree-level-1 .tree-cell { padding-left: 10px; }
  .tree-level-2 .tree-cell { padding-left: 20px; }
  .tree-level-3 .tree-cell { padding-left: 30px; }
  .tree-level-4 .tree-cell { padding-left: 40px; }
  .tree-level-5 .tree-cell { padding-left: 50px; }
}

@media (max-width: 620px) {
  header { display: flex; gap: 10px; }
  .brand { font-size: 12px; }
  .nav-tab { padding: 6px 7px; font-size: 12px; }
  .filters { grid-template-columns: 1fr; }
  .dimension-order-field,
  .tag-filter-field { grid-column: auto; }
  .dimension-order-popover { width: min(360px, calc(100vw - 36px)); }
  .tag-filter-popover { width: min(360px, calc(100vw - 36px)); }
  .tag-filter-grid { grid-template-columns: 1fr; }
}

/* The project actions keep their row when the summary next to them gets long. */
@media (min-width: 621px) {
  .page-heading .heading-actions { flex-shrink: 0; flex-wrap: nowrap; }
}
