/* Shared month/range picker used by settlement list and dashboard. */
.period-filter-wrap {
  position: relative;
}

.period-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: .65rem .9rem;
  border: 1px solid #d7e3eb;
  border-radius: 12px;
  background: #fff;
  color: #28485b;
  font-weight: 600;
  box-shadow: none;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.period-trigger:hover {
  border-color: #96bbcf;
  background: #f8fbfd;
  color: #0b5c8e;
}

.period-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settlement-period-picker {
  position: absolute;
  z-index: 40;
  top: calc(100% + .55rem);
  left: 0;
  width: fit-content;
  min-width: 398px;
  max-width: min(498px, 72vw);
  display: none;
  background: #fff;
  border: 1px solid #dbe6ed;
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(21, 56, 79, .10);
  overflow: hidden;
}

.settlement-period-picker.show {
  display: grid;
  grid-template-columns: 92px minmax(300px, 1fr);
}

.period-picker-align-end .settlement-period-picker {
  left: auto;
  right: 0;
}

.period-shortcuts {
  padding: .65rem;
  border-right: 1px solid #e7eef3;
  background: #f8fbfd;
  min-width: 84px;
}

.period-shortcuts-title,
.period-main-title {
  margin-bottom: .5rem;
  color: #5d7485;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.period-shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: .28rem;
}

.period-shortcut-btn,
.period-cell-btn,
.period-nav-btn {
  border: 0;
  background: transparent;
}

.period-shortcut-btn {
  padding: .4rem .5rem;
  border-radius: 8px;
  text-align: left;
  color: #426173;
  font-weight: 600;
  font-size: .78rem;
  transition: background-color .15s ease, color .15s ease;
}

.period-shortcut-btn:hover,
.period-shortcut-btn.active {
  background: #eaf3f8;
  color: #0b5c8e;
}

.period-main {
  padding: .92rem;
}

.period-main-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .58rem;
}

.period-main-tip {
  color: #7d92a1;
  font-size: .72rem;
  line-height: 1.35;
  text-align: right;
}

.period-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .58rem;
  padding-bottom: .42rem;
  border-bottom: 1px solid #edf2f6;
}

.period-nav-select {
  min-width: 108px;
  height: 34px;
  padding: .34rem 2rem .34rem .72rem;
  border: 1px solid rgba(11, 92, 142, 0.14);
  border-radius: 10px;
  background: #f8fbfe;
  background-image: linear-gradient(45deg, transparent 50%, #6f8797 50%), linear-gradient(135deg, #6f8797 50%, transparent 50%);
  background-position: calc(100% - 15px) calc(50% - 1px), calc(100% - 10px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: #28485b;
  font-size: .84rem;
  font-weight: 700;
  appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.period-nav-select:hover {
  border-color: rgba(11, 92, 142, 0.24);
  background-color: #f3f8fc;
}

.period-nav-select:focus {
  border-color: #9bbfd1;
  box-shadow: 0 0 0 .12rem rgba(11, 92, 142, .08);
}

.period-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: #728998;
  font-size: .82rem;
  font-weight: 700;
  transition: background-color .15s ease, color .15s ease;
}

.period-nav-btn:hover {
  background: #eef4f7;
  color: #0b5c8e;
}

.period-grid.months {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .42rem .48rem;
}

.period-cell-btn {
  min-height: 42px;
  padding: .48rem .42rem;
  border-radius: 12px;
  background: rgba(11, 92, 142, 0.04);
  color: #38586a;
  font-weight: 700;
  font-size: .84rem;
  border: 0;
  box-shadow: none;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.period-cell-btn:hover {
  background: rgba(11, 92, 142, 0.1);
  color: #0b5c8e;
}

.period-cell-btn.active {
  background: linear-gradient(135deg, #0b5c8e, #1b96c6);
  color: #fff;
  box-shadow: none;
}

.period-cell-btn.in-range {
  background: #edf6fc;
  color: #0b5c8e;
  box-shadow: none;
}

.period-range-summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .75rem;
  align-items: center;
  margin-top: .62rem;
  padding: .6rem .72rem;
  border-radius: 12px;
  border: 1px solid #dde8f0;
  background: linear-gradient(180deg, #fbfdfe 0%, #f6fafc 100%);
}

.period-range-summary.is-hidden {
  display: none;
}

.period-range-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .18rem;
  min-width: 0;
}

.period-range-caption {
  color: #87a0af;
  font-size: .68rem;
  line-height: 1;
  letter-spacing: .03em;
}

.period-range-value {
  text-align: center;
  font-weight: 700;
  color: #2d4d5f;
  font-size: .78rem;
  min-height: 1.2rem;
}

.period-range-sep {
  color: #8ba0ae;
  font-weight: 700;
  font-size: .78rem;
}

.period-picker-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: .62rem;
  padding-top: .55rem;
  border-top: 1px solid #e7eef3;
  color: #718796;
  font-size: .72rem;
}

.period-picker-foot-label {
  display: none;
}

.period-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
}

.period-picker-close {
  min-height: 28px;
  padding: .28rem .64rem;
  border-radius: 8px;
  border: 1px solid #d6e5ee;
  background: #fff;
  color: #546c7c;
  font-weight: 600;
  font-size: .74rem;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.period-picker-close:hover {
  background: #f5f9fb;
  border-color: #bcd2df;
  color: #0b5c8e;
}

.period-picker-confirm {
  min-height: 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .76rem;
}

@media (max-width: 991.98px) {
  .settlement-period-picker.show {
    grid-template-columns: 1fr;
    width: min(92vw, 498px);
    min-width: 0;
  }

  .period-picker-align-end .settlement-period-picker {
    left: auto;
    right: 0;
  }

  .period-shortcuts {
    border-right: 0;
    border-bottom: 1px solid #e7eef3;
  }

  .period-shortcuts-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
