:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #66717c;
  --paper: #f5f2eb;
  --panel: rgba(255, 255, 255, 0.94);
  --line: rgba(23, 33, 43, 0.14);
  --accent: #ca5b32;
  --accent-dark: #8f3317;
  --teal: #1b756d;
  --drawer-blue: #1f66d1;
  --drawer-blue-dark: #1554b2;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

button { font: inherit; }

.app-shell {
  display: grid;
  grid-template-rows: 1fr;
  width: 100%;
  height: 100%;
}

p { margin: 0; }

.map-panel {
  position: relative;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #dce3de;
}

.drawer-open {
  position: absolute;
  top: 72px;
  left: 14px;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #ffffff;
  background: var(--drawer-blue);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 7px;
  box-shadow: 0 8px 22px rgba(31, 102, 209, 0.28);
  cursor: pointer;
}

.drawer-open:active {
  transform: translateY(1px);
}

.drawer-open[hidden] {
  display: none;
}

.drawer-open__icon,
.drawer-close__icon {
  position: relative;
  display: block;
  width: 20px;
  height: 18px;
}

.drawer-open__icon::before,
.drawer-open__icon::after,
.drawer-close__icon::before,
.drawer-close__icon::after {
  position: absolute;
  top: 4px;
  width: 9px;
  height: 9px;
  content: "";
}

.drawer-open__icon::before,
.drawer-open__icon::after {
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.drawer-open__icon::before {
  left: 2px;
}

.drawer-open__icon::after {
  left: 9px;
}

.branch-drawer {
  position: absolute;
  top: 14px;
  left: calc(0px - min(150px, calc(100vw - 56px)) - 18px);
  z-index: 9;
  width: min(150px, calc(100vw - 56px));
  max-height: calc(100% - 32px);
  overflow: visible;
  color: var(--ink);
  transition: width 180ms ease, left 180ms ease;
}

.branch-drawer.branch-drawer--open {
  left: 0;
}

.branch-drawer--selected {
  width: min(406px, calc(100vw - 56px));
}

.branch-drawer--selected:not(.branch-drawer--open) {
  left: calc(0px - min(406px, calc(100vw - 56px)) - 18px);
}

.branch-drawer__head,
.branch-list,
.scope-info {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(23, 33, 43, 0.14);
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.16);
}

.branch-drawer__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 5px 8px 5px 10px;
  border-radius: 0 4px 4px 0;
}

.branch-drawer--selected .branch-drawer__head {
  border-bottom-color: rgba(23, 33, 43, 0.1);
  box-shadow: 0 4px 14px rgba(23, 33, 43, 0.1);
}

.scope-reselect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  min-height: 30px;
  padding: 0 8px 0 0;
  color: #17212b;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: default;
}

.branch-drawer--selected .scope-reselect::before {
  width: 3px;
  height: 20px;
  flex: 0 0 auto;
  content: "";
  background: var(--drawer-blue);
}

.branch-drawer--selected .scope-reselect {
  cursor: pointer;
}

.branch-drawer--selected .scope-reselect:hover {
  background: rgba(31, 102, 209, 0.08);
}

.branch-drawer__title {
  overflow: hidden;
  color: var(--drawer-blue);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-drawer:not(.branch-drawer--selected) .branch-drawer__title {
  color: #17212b;
  font-size: 12px;
  font-weight: 600;
}

.scope-reselect__icon {
  display: none;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid rgba(31, 102, 209, 0.28);
  border-radius: 4px;
  background: #ffffff;
  position: relative;
}

.branch-drawer--selected .scope-reselect__icon {
  display: block;
}

.scope-reselect__icon::before {
  position: absolute;
  top: 6px;
  left: 7px;
  width: 6px;
  height: 6px;
  content: "";
  border-right: 2px solid var(--drawer-blue);
  border-bottom: 2px solid var(--drawer-blue);
  transform: rotate(45deg);
}

.branch-drawer--choosing .scope-reselect__icon::before {
  top: 9px;
  transform: rotate(225deg);
}

.drawer-close {
  position: absolute;
  top: 7px;
  right: -44px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: #ffffff;
  background: var(--drawer-blue);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 50%;
  box-shadow: 0 6px 16px rgba(31, 102, 209, 0.28);
  cursor: pointer;
}

.branch-drawer:not(.branch-drawer--open) .drawer-close {
  display: none;
}

.drawer-close__icon::before,
.drawer-close__icon::after {
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.drawer-close__icon::before {
  left: 4px;
}

.drawer-close__icon::after {
  left: 11px;
}

.branch-list {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  padding: 7px 6px 8px;
  border-radius: 0 4px 4px 0;
}

.branch-drawer--selected:not(.branch-drawer--choosing) .branch-list {
  display: none;
}

.branch-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 27px;
  padding: 0 6px;
  color: #33404b;
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.branch-item--child {
  padding-left: 18px;
}

.branch-item:hover,
.branch-item--active {
  color: var(--drawer-blue);
  background: rgba(31, 102, 209, 0.1);
}

.branch-item__swatch {
  width: 14px;
  height: 8px;
  flex: 0 0 auto;
  border: 2px solid var(--branch-color, var(--drawer-blue));
  background: color-mix(in srgb, var(--branch-color, var(--drawer-blue)) 28%, transparent);
}

.scope-info {
  display: block;
  margin-top: 0;
  padding: 12px 14px 14px;
  border-radius: 0 4px 4px 0;
  border-top: 0;
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.14);
}

.scope-info.hidden {
  display: none;
}

.branch-drawer--choosing .scope-info {
  display: none;
}

.scope-info__card {
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(23, 33, 43, 0.12);
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(23, 33, 43, 0.12);
}

.scope-info__summary {
  display: grid;
  gap: 9px;
  color: #33404b;
  font-size: 13px;
  line-height: 1.45;
}

.scope-info__row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: start;
}

.scope-info__row--jurisdiction {
  color: #243746;
  font-weight: 600;
}

.scope-info__icon {
  position: relative;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: #40505c;
}

.scope-info__icon::before,
.scope-info__icon::after {
  position: absolute;
  content: "";
}

.scope-info__icon--jurisdiction::before {
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.scope-info__icon--jurisdiction::after {
  top: 6px;
  left: 6px;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
}

.scope-info__icon--person::before {
  top: 1px;
  left: 5px;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.scope-info__icon--person::after {
  top: 9px;
  left: 3px;
  width: 10px;
  height: 6px;
  background: currentColor;
  border-radius: 6px 6px 2px 2px;
}

.scope-info__icon--users::before {
  top: 2px;
  left: 2px;
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 7px 0 0 currentColor;
}

.scope-info__icon--users::after {
  top: 9px;
  left: 1px;
  width: 14px;
  height: 6px;
  background: currentColor;
  border-radius: 6px 6px 2px 2px;
}

.scope-info__icon--revenue {
  display: grid;
  place-items: center;
  background: currentColor;
  border-radius: 50%;
}

.scope-info__icon--revenue::before {
  color: #ffffff;
  content: "¥";
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
}

.map-reset-view {
  position: absolute;
  right: 18px;
  bottom: 118px;
  z-index: 7;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  color: var(--drawer-blue);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 33, 43, 0.16);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(23, 33, 43, 0.18);
  cursor: pointer;
}

.map-reset-view:active {
  transform: translateY(1px);
}

.map-reset-view__arrow {
  display: block;
  height: 18px;
  font-size: 22px;
  line-height: 18px;
}

.map-reset-view__label {
  display: block;
  margin-top: -2px;
  font-size: 11px;
  font-weight: 700;
  line-height: 12px;
}

.status-card {
  position: absolute;
  z-index: 6;
  right: 20px;
  padding: 10px 14px;
  color: #fff;
  border-radius: 2px;
  background: rgba(23, 33, 43, 0.86);
  box-shadow: 0 8px 26px rgba(23, 33, 43, 0.17);
  font-size: 12px;
}

.status-card { top: 20px; }
.status-card.hidden { display: none; }
.status-card.error { background: #982f27; }

@media (max-width: 720px) {
  .drawer-open {
    top: 74px;
    left: 12px;
    width: 42px;
    height: 42px;
  }

  .branch-drawer {
    top: 12px;
    left: calc(0px - min(146px, calc(100vw - 54px)) - 18px);
    width: min(146px, calc(100vw - 54px));
  }

  .branch-drawer--selected {
    width: min(334px, calc(100vw - 54px));
  }

  .branch-drawer--selected:not(.branch-drawer--open) {
    left: calc(0px - min(334px, calc(100vw - 54px)) - 18px);
  }

  .branch-drawer__head {
    min-height: 40px;
    padding: 5px 8px;
  }

  .drawer-close {
    top: 6px;
    right: -42px;
    width: 30px;
    height: 30px;
  }

  .branch-drawer__title {
    font-size: 14px;
  }

  .branch-drawer:not(.branch-drawer--selected) .branch-drawer__title { font-size: 12px; }

  .branch-list {
    gap: 3px;
    padding: 6px;
  }

  .branch-item { min-height: 29px; font-size: 12px; }
  .scope-info { padding: 10px; }
  .scope-info__card { padding: 11px; }
  .scope-info__summary { font-size: 12px; }

  .map-reset-view {
    right: 18px;
    bottom: 160px;
    width: 46px;
    height: 46px;
  }

  .status-card { top: auto; right: 12px; bottom: 54px; }
}
