:root {
  --paper:#f4f6f2;
  --ink:#17372e;
  --muted:#5d7065;
  --green:#205b46;
  --line:#e0e6dd;
  --white:#fff;
  --gold:#d7a94c;
  --red:#a3463f}
* {
  box-sizing: border-box
}
body {
  margin: 0;
  font: 14px/1.6 -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  color: var(--ink);
  background: var(--paper)
}
button,input,select,textarea {
  font: inherit
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 14px;
  transition: background-color .15s,border-color .15s,color .15s
}
button:hover {
  border-color: #77a28d;
  background: #f4f8f4
}
button:disabled {
  opacity: .5;
  cursor: default
}
button.primary,.primary {
  background: var(--green);
  color: white;
  border-color: var(--green)
}
button.danger {
  color: var(--red)
}
input,select,textarea {
  width: 100%;
  border: 1px solid #d4ddd3;
  padding: 9px 11px;
  border-radius: 7px;
  background: white;
  color: var(--ink);
  outline: none
}
input:focus,select:focus,textarea:focus {
  border-color: #37775d;
  box-shadow: 0 0 0 3px #37775d15
}
label {
  display: grid;
  gap: 6px;
  color: #53695b;
  font-size: 13px
}
small {
  color: var(--muted);
  font-size: 12px
}
h1,h2,h3,p {
  margin: 0
}
h2 {
  font-size: 21px
}
h3 {
  font-size: 16px;
  margin-bottom: 15px
}
a {
  color: var(--green)
}
[hidden] {
  display: none!important
}
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #8b9a8e
}
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr
}
.auth-art {
  background: var(--green);
  padding: 11vh 10%;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative
}
.auth-art .eyebrow {
  color: #bfd2c2
}
.auth-art h1 {
  font-size: clamp(32px,3.6vw,57px);
  line-height: 1.5;
  letter-spacing: 1px;
  margin: 34px 0
}
.auth-art p {
  color: #d4e2d3;
  font-size: 16px
}
.auth-mark {
  margin-top: 90px;
  color: #c3d7c7;
  font-size: 12px
}
.auth-form {
  max-width: 430px;
  align-self: center;
  padding: 40px;
  width: 100%;
  margin: auto
}
.brand-icon {
  width: 43px;
  height: 43px;
  background: var(--green);
  color: white;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 21px;
  flex-shrink: 0
}
.auth-form h2 {
  margin-top: 25px
}
.auth-form p {
  color: var(--muted);
  margin: 9px 0 28px
}
.auth-form form {
  display: grid;
  gap: 18px;
  margin-bottom: 22px
}
.auth-form button {
  padding: 12px
}
.error {
  color: var(--red)!important
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 28px 20px 36px
}
.brand strong {
  font-size: 18px
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  margin-top: 2px
}
aside {
  width: 232px;
  background: #fafbf8;
  border-right: 1px solid var(--line);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column
}
nav {
  display: grid;
  gap: 8px;
  padding: 0 14px
}
nav :is(button,a) {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 13px 14px;
  color: #65796a
}
nav span {
  float: right;
  opacity: .45;
  font-size: 10px;
  padding-top: 3px
}
nav .active {
  background: #e6eee3;
  color: #245c45;
  font-weight: 700
}
.side-foot {
  margin-top: auto;
  padding: 24px;
  display: grid;
  gap: 7px;
  font-size: 12px
}
.side-foot span {
  color: var(--muted)
}
.side-foot button {
  margin: 8px 0;
  text-align: left;
  background: transparent
}
main {
  margin-left: 232px;
  padding: 30px 35px 70px;
  max-width: 1900px
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px
}
header h1 {
  font-size: 27px;
  letter-spacing: 1px;
  margin-top: 4px
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px
}
.trial,.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 5px;
  background: #e8eee4;
  color: #46694d;
  white-space: nowrap
}
.trial {
  background: #eee7ce;
  color: #7e682f
}
.tag.red {
  background: #f6e8e4;
  color: var(--red)
}
.tag.gold {
  background: #f7eed9;
  color: #856c33
}
.notice {
  background: #eef1e7;
  border: 1px solid #dce3cc;
  border-radius: 9px;
  padding: 11px 15px;
  font-size: 12px;
  color: #6c7555;
  margin-bottom: 25px
}
.notice strong {
  color: #596443
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 16px;
  margin: 23px 0
}
.kpi,.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 23px
}
.kpi {
  position: relative;
  overflow: hidden
}
.kpi small {
  display: block;
  margin-top: 6px
}
.kpi .value {
  font-size: 32px;
  line-height: 1.3;
  margin-top: 13px;
  font-weight: 600;
  letter-spacing: -1px
}
.kpi .label {
  font-size: 12px;
  color: #788575
}
.kpi.accent {
  background: var(--green);
  color: white
}
.kpi.accent .label,.kpi.accent small {
  color: #c3d6c3
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px
}
.card {
  margin-bottom: 20px
}
.card-head,.toolbar,.between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px
}
.card-head {
  margin-bottom: 18px
}
.card-head h3 {
  margin: 0
}
.muted {
  color: var(--muted)
}
.toolbar {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-bottom: 18px
}
.toolbar label {
  min-width: 150px;
  flex: 1
}
.toolbar .wide {
  flex: 2;
  min-width: 240px
}
.toolbar button {
  align-self: end;
  white-space: nowrap
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px
}
table {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  font-size: 12px
}
th {
  background: #f5f7f2;
  color: #6b7a6c;
  font-weight: 500;
  text-align: left;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line)
}
td {
  padding: 12px 13px;
  border-bottom: 1px solid #edf0e9
}
tr:last-child td {
  border: 0
}
td small {
  display: block
}
td button {
  padding: 5px 10px;
  font-size: 12px
}
td.number {
  font-variant-numeric: tabular-nums
}
.empty {
  text-align: center;
  padding: 45px;
  color: var(--muted)
}
.help {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0
}
.layout-book {
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: 20px
}
.cart {
  position: sticky;
  top: 20px;
  align-self: start
}
.cart h3 {
  margin: 0
}
.cart-list {
  max-height: 290px;
  overflow: auto;
  margin: 16px 0
}
.cart-item {
  font-size: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px
}
.cart-item small {
  font-size: 10px
}
.cart-item button {
  border: 0;
  padding: 0 6px;
  font-size: 17px;
  color: #9a8276
}
.cart form {
  display: grid;
  gap: 12px
}
.cart-total {
  font-size: 27px;
  margin: 14px 0
}
.cart-total small {
  font-size: 11px
}
.checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  vertical-align: middle
}
.position {
  background: #f4f7f2;
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 12px
}
.position.stopped {
  opacity: .55
}
.position label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer
}
.position.busy {
  background: #faf0e8
}
.position.selected {
  outline: 2px solid #37775d
}
.lift-group {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
  gap: 9px;
  margin-top: 10px
}
details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 15px;
  margin-bottom: 12px;
  background: white
}
summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600
}
summary small {
  font-weight: 400;
  margin-left: 9px
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 15px;
  font-size: 12px;
  color: var(--muted)
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px
}
.full {
  grid-column: 1/-1
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px
}
dialog {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  width: min(1000px,94vw);
  max-height: 88vh;
  color: var(--ink);
  box-shadow: 0 30px 100px #15322335
}
dialog::backdrop {
  background: #122b215c;
  backdrop-filter: blur(2px)
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px
}
.dialog-head button {
  border: 0;
  font-size: 24px;
  padding: 0 8px
}
.dialog-head h2 {
  font-size: 20px
}
dialog h3 {
  margin-top: 25px
}
.section-note {
  border-left: 3px solid #b5cdb3;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0
}
#toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: #205b46;
  color: white;
  border-radius: 9px;
  padding: 13px 22px;
  box-shadow: 0 8px 30px #132e2420;
  display: none;
  max-width: 90vw
}
#toast.visible {
  display: block
}
#toast.bad {
  background: #934d42
}
.loading {
  padding: 70px;
  text-align: center;
  color: var(--muted)
}
.inline {
  display: flex;
  align-items: center;
  gap: 9px
}
.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0
}
.flow span {
  background: #edf2e9;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 12px
}
.admin-list {
  display: grid;
  gap: 10px
}
.backup-link {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 12px
}
.subnav {
  display: flex;
  gap: 10px;
  margin: 12px 0
}
.resource-count {
  font-size: 12px;
  color: var(--muted)
}
@media(max-width:1150px) {
  main {
    padding: 25px 22px
  }
  .layout-book {
    grid-template-columns: 1fr
  }
  .cart {
    position: static
  }
  .cart-list {
    max-height: 200px
  }
  .kpis {
    grid-template-columns: repeat(2,1fr)
  }
  .grid2 {
    grid-template-columns: 1fr
  }
}
@media(max-width:700px) {
  aside {
    position: static;
    width: auto
  }
  .brand {
    padding: 18px
  }
  .side-foot {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px
  }
  .side-foot small {
    display: none
  }
  nav {
    display: flex;
    overflow: auto;
    padding-bottom: 12px
  }
  nav :is(button,a) {
    white-space: nowrap;
    padding: 9px 12px
  }
  nav span {
    display: none
  }
  main {
    margin: 0;
    padding: 20px 14px
  }
  .header-actions {
    gap: 6px
  }
  .header-actions button {
    font-size: 12px
  }
  header h1 {
    font-size: 23px
  }
  .notice {
    font-size: 11px
  }
  .auth {
    grid-template-columns: 1fr
  }
  .auth-art {
    padding: 40px
  }
  .auth-art h1 {
    font-size: 32px;
    margin: 20px 0
  }
  .auth-mark {
    margin-top: 25px
  }
  .auth-form {
    padding: 30px
  }
  .kpis {
    gap: 10px
  }
  .kpi {
    padding: 17px
  }
  .kpi .value {
    font-size: 26px
  }
  .form-grid {
    grid-template-columns: 1fr
  }
  .card {
    padding: 17px
  }
  .trial {
    display: none
  }
  .toolbar label {
    min-width: 125px
  }
}

.scope-control {
  flex: 2;
  min-width: 220px;
  display: grid;
  gap: 6px
}
.scope-control>span {
  font-size: 13px;
  color: #53695b
}
.scope-control button {
  justify-self: start
}
.scope-control small {
  max-width: 550px;
  max-height: 44px;
  overflow: auto;
  display: block
}
.community-picker-list {
  max-height: 48vh;
  overflow: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px
}
.community-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f4f7f2;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer
}
.community-option:has(input:checked) {
  background: #e6eee3;
  border-color: #8eb39a
}
.community-option small {
  display: block
}
.community-option input {
  flex-shrink: 0
}
#community-picker-count {
  font-size: 13px;
  margin-left: auto
}
@media(max-width:700px) {
  .community-picker-list {
    grid-template-columns: 1fr
  }
}
#community-picker-form {
  display: flex;
  flex-direction: column;
  max-height: calc(80vh - 105px)
}
#community-picker-form>.community-picker-list {
  flex: 1;
  min-height: 85px;
  max-height: 42vh
}
#community-picker-form>.actions {
  flex-shrink: 0;
  margin-top: 12px
}
#community-picker-form>.toolbar {
  margin-top: 8px;
  margin-bottom: 10px
}

.booking-modes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line)
}
.booking-modes>span {
  color: var(--muted);
  font-size: 12px
}

.brand-icon.has-company-logo {
  padding: 3px;
  background: transparent;
  border-radius: 0
}
.brand-icon img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain
}
.brand-icon.wordmark-logo {
  width: 190px;
  height: 70px
}
.brand.wordmark-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding-top: 22px;
  padding-bottom: 25px
}
.wordmark-brand #brand-name {
  display: none
}
.auth-form>.brand-icon.wordmark-logo {
  width: 245px;
  height: 88px
}
.company-logo-preview {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  background: white;
  color: var(--muted)
}
.company-logo-preview img {
  max-height: 76px;
  max-width: 100%;
  object-fit: contain
}
/* Keep criteria and results independently scrollable in the community picker. */
#community-picker-form {
  max-height: calc(85vh - 100px);
  min-height: 380px
}
#geo-criteria {
  margin: 0;
  flex-shrink: 0;
  max-height: 42vh;
  overflow: auto;
  background: #f7f9f5
}
#geo-criteria:not([open]) {
  max-height: none
}
#geo-criteria summary {
  position: sticky;
  top: -12px;
  background: #f7f9f5;
  padding: 8px 0;
  z-index: 1
}
.region-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0
}
.region-options label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px
}
.geo-near {
  padding-top: 8px;
  border-top: 1px solid var(--line)
}
#community-picker-form>.community-picker-list {
  min-height: 100px;
  max-height: none
}
#community-picker-form>.help {
  margin: 10px 0;
  font-size: 12px
}
.community-option {
  align-items: flex-start
}
.community-option .tag {
  font-size: 11px;
  margin-top: 5px
}
.community-option input {
  margin-top: 4px
}
#centers-mapping {
  margin-top: 15px
}
#centers-mapping:empty {
  display: none
}
/* Shared form rhythm, including native Safari selects and file controls. */
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  min-width: 0
}
.form-grid {
  align-items: start;
  gap: 18px 20px
}
.form-grid>label {
  align-self: start;
  width: 100%
}
input:not([type=checkbox]):not([type=radio]),select {
  height: 44px;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 22px;
  border-radius: 8px
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%2365796a' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center
}
input[type=file] {
  padding: 5px 8px!important;
  font-size: 13px!important;
  line-height: 30px!important;
  overflow: hidden
}
input::file-selector-button {
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: #edf2e9;
  color: var(--green);
  font: inherit;
  padding: 3px 10px;
  margin-right: 10px
}
textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.6
}
input[type=checkbox],input[type=radio] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--green);
  flex-shrink: 0
}
button {
  min-height: 40px;
  font-size: 13px;
  line-height: 20px
}
.toolbar {
  row-gap: 16px
}
.toolbar>button {
  min-height: 44px
}
.toolbar label small,.form-grid label small {
  line-height: 1.5;
  min-height: 18px
}
.dialog-head {
  margin-bottom: 20px
}
.dialog-head button {
  min-width: 32px;
  min-height: 32px;
  line-height: 28px
}
.table-wrap td {
  vertical-align: middle
}
.table-wrap td button {
  font-size: 12px;
  min-height: 34px;
  padding: 6px 10px
}
.list-order-note {
  display: block;
  margin: 0 0 8px;
  color: #8a978c
}
#community-picker-form>.toolbar {
  align-items: center;
  gap: 10px
}
#community-picker-form>.community-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white
}
#community-picker-form .community-option {
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) 215px;
  align-items: center;
  column-gap: 14px;
  padding: 13px 16px;
  min-height: 76px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid #e8ede5;
  border-radius: 0;
  background: white;
  flex-shrink: 0
}
#community-picker-form .community-option:last-child {
  border-bottom: 0
}
#community-picker-form .community-option:hover {
  background: #f4f7f1
}
#community-picker-form .community-option:has(input:checked) {
  background: #edf4e9;
  box-shadow: inset 3px 0 #468164
}
#community-picker-form .community-option input {
  margin: 0
}
#community-picker-form .community-line-main {
  min-width: 0;
  display: grid;
  gap: 5px
}
.community-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px
}
.community-code {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #74857b;
  min-width: 85px
}
.community-title>b {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink)
}
.community-line-side {
  display: grid;
  justify-items: end;
  gap: 5px;
  font-variant-numeric: tabular-nums
}
.community-option .community-line-side .tag {
  margin: 0;
  font-size: 11px
}
.community-option small {
  font-size: 12px;
  line-height: 1.5
}
.region-options label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  margin: 0
}
.region-options {
  gap: 8px
}
#geo-criteria {
  padding: 14px 16px
}
#geo-criteria summary {
  top: -14px;
  padding: 6px 0 10px
}
#geo-criteria .help {
  font-size: 12px;
  line-height: 1.6;
  margin: 12px 0
}
#geo-criteria .toolbar {
  margin: 12px 0
}
.geo-near {
  padding-top: 16px
}
#geo-criteria .form-grid {
  grid-template-columns: 1fr 1fr
}
#community-picker-form>.actions {
  padding-top: 10px;
  border-top: 1px solid var(--line)
}
@media(max-width:700px) {
  #geo-criteria .form-grid {
    grid-template-columns: 1fr
  }
  #community-picker-form .community-option {
    grid-template-columns: 20px minmax(0,1fr);
    padding: 12px;
    gap: 10px
  }
  .community-line-side {
    grid-column: 2;
    justify-items: start;
    display: flex;
    flex-wrap: wrap;
    gap: 10px
  }
  .community-code {
    min-width: 0
  }
  .community-title {
    gap: 8px
  }
  #community-picker-form {
    min-height: 320px
  }
}
.position label {
  flex-direction: row;
  align-items: center
}
.geo-query-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  flex-shrink: 0
}
.geo-query-bar small {
  line-height: 1.5
}
dialog[open] {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden
}
.dialog-head {
  flex-shrink: 0
}
#dialog-body {
  min-height: 0;
  overflow: auto
}
#dialog-body:has(#community-picker-form) {
  display: flex;
  flex: 1;
  overflow: hidden
}
#community-picker-form {
  width: 100%;
  height: calc(90vh - 115px);
  max-height: calc(90vh - 115px);
  min-height: 0;
  margin: 0
}
#geo-criteria {
  flex: 0 1 auto;
  min-height: 54px;
  max-height: 28vh
}
#geo-criteria:not([open]) {
  min-height: 54px;
  flex-shrink: 0
}
#community-picker-form>.community-picker-list {
  min-height: 100px;
  flex: 1
}
#community-picker-form>.actions {
  flex-shrink: 0;
  margin-top: 10px;
  background: white
}
#community-picker-form>.help {
  margin: 8px 0;
  flex-shrink: 0
}
#community-picker-form>label {
  flex-shrink: 0
}
#community-picker-form>.toolbar {
  margin: 10px 0;
  flex-shrink: 0
}
/* Compact filters; the community list gets the remaining dialog height. */
dialog:has(#community-picker-form) {
  width: min(1200px,96vw);
  max-height: 94vh;
  padding: 20px
}
dialog:has(#community-picker-form) .dialog-head {
  margin-bottom: 12px
}
dialog:has(#community-picker-form) .dialog-head h2 {
  font-size: 19px
}
#community-picker-form {
  height: calc(94vh - 96px);
  max-height: calc(94vh - 96px)
}
.region-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f5;
  flex-shrink: 0
}
.region-bar-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap
}
.region-bar .region-options {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0
}
.region-bar .region-options label {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
  gap: 6px;
  line-height: 20px
}
.region-bar input[type=checkbox] {
  width: 15px;
  height: 15px;
  min-height: 15px
}
.region-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  white-space: nowrap
}
.region-bar-actions button {
  min-height: 30px;
  height: 30px;
  font-size: 12px;
  padding: 4px 9px;
  line-height: 20px
}
#geo-criteria {
  min-height: 38px;
  max-height: 24vh;
  padding: 8px 12px
}
#geo-criteria:not([open]) {
  min-height: 38px
}
#geo-criteria summary {
  top: -8px;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 600
}
#geo-criteria .geo-near {
  padding-top: 10px;
  margin-top: 8px
}
#geo-criteria .form-grid {
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 10px 14px
}
#geo-criteria label {
  font-size: 12px;
  gap: 5px
}
#geo-criteria input:not([type=checkbox]):not([type=radio]),#geo-criteria select {
  height: 34px;
  min-height: 34px;
  font-size: 12px;
  line-height: 18px;
  padding: 7px 9px
}
#geo-criteria select {
  padding-right: 30px
}
#geo-criteria input[type=file] {
  line-height: 24px!important;
  padding: 4px 7px!important;
  font-size: 12px!important
}
#geo-criteria input::file-selector-button {
  height: 24px;
  padding: 2px 7px
}
#geo-criteria .help,#geo-criteria small {
  font-size: 11px;
  line-height: 1.5
}
#geo-criteria .help {
  margin: 8px 0
}
#geo-criteria .toolbar {
  margin: 8px 0;
  gap: 6px
}
#geo-criteria .toolbar>button {
  min-height: 30px;
  height: 30px;
  font-size: 12px;
  padding: 4px 9px
}
.geo-query-bar {
  padding-top: 4px;
  gap: 10px
}
.geo-query-bar button {
  height: 32px;
  min-height: 32px;
  font-size: 12px;
  padding: 5px 12px
}
.geo-query-bar small {
  font-size: 11px
}
#community-picker-form>.help {
  font-size: 11px;
  margin: 5px 0
}
#community-picker-form>.picker-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 10px
}
#community-picker-form .picker-search-field {
  flex: 1;
  min-width: 190px;
  max-width: 420px;
  gap: 0
}
#community-picker-form .picker-search-field input {
  height: 34px;
  min-height: 34px;
  font-size: 12px;
  padding: 7px 10px
}
#community-picker-form>.picker-list-toolbar>button {
  height: 34px;
  min-height: 34px;
  font-size: 12px;
  padding: 6px 10px
}
#community-picker-count {
  font-size: 12px;
  white-space: nowrap
}
#community-picker-form .community-option {
  min-height: 64px;
  padding: 9px 14px
}
#community-picker-form .community-line-main {
  gap: 3px
}
#community-picker-form>.actions {
  margin-top: 8px;
  padding-top: 8px
}
#community-picker-form>.actions>button {
  min-height: 36px;
  height: 36px;
  padding: 7px 16px;
  font-size: 13px
}
@media(max-width:700px) {
  .region-bar-actions {
    margin-left: 0
  }
  .region-bar .region-options {
    flex-basis: calc(100% - 60px)
  }
  #geo-criteria .form-grid {
    grid-template-columns: 1fr 1fr
  }
  #community-picker-form .picker-search-field {
    max-width: none;
    flex-basis: 100%
  }
  #community-picker-count {
    margin-left: 0
  }
  dialog:has(#community-picker-form) {
    padding: 14px
  }
  #community-picker-form {
    height: calc(94vh - 85px);
    max-height: calc(94vh - 85px)
  }
}
/* Compact desktop workspace: keep filters secondary to the resource detail. */
@media(min-width:701px) {
  aside {
    width: 208px
  }
  main {
    margin-left: 208px;
    padding: 20px 24px 44px
  }
  header {
    margin-bottom: 14px
  }
  header h1 {
    font-size: 23px;
    margin-top: 2px
  }
  .header-actions {
    gap: 8px
  }
  .brand {
    padding: 20px 16px 22px
  }
  .brand.wordmark-brand {
    padding: 16px 14px 20px
  }
  .brand-icon.wordmark-logo {
    width: 170px;
    height: 56px
  }
  nav {
    gap: 4px;
    padding: 0 12px
  }
  nav :is(button,a) {
    padding: 9px 12px;
    font-size: 13px
  }
  .side-foot {
    padding: 16px;
    gap: 4px
  }
  .side-foot button {
    margin: 4px 0
  }
  .card {
    padding: 15px 16px;
    margin-bottom: 14px;
    border-radius: 9px
  }
  .card-head {
    margin-bottom: 12px;
    gap: 10px
  }
  .toolbar {
    gap: 10px;
    row-gap: 10px;
    margin-bottom: 12px
  }
  .toolbar label {
    min-width: 120px
  }
  .toolbar .wide {
    min-width: 180px
  }
  label {
    font-size: 12px;
    gap: 5px
  }
  input:not([type=checkbox]):not([type=radio]),select {
    height: 36px;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 20px
  }
  select {
    padding-right: 32px
  }
  button,.toolbar>button {
    min-height: 34px;
    font-size: 12px;
    line-height: 20px;
    padding: 6px 11px
  }
  input[type=file] {
    padding: 4px 7px!important;
    font-size: 12px!important;
    line-height: 24px!important
  }
  input::file-selector-button {
    height: 24px;
    padding: 2px 8px
  }
  textarea {
    min-height: 78px;
    padding: 8px 10px;
    font-size: 13px
  }
  .notice {
    padding: 7px 11px;
    font-size: 11px;
    margin-bottom: 14px
  }
  .kpis {
    gap: 12px;
    margin: 14px 0
  }
  .kpi {
    padding: 15px 16px
  }
  .kpi .value {
    font-size: 28px
  }
  .kpi .label {
    font-size: 11px
  }
  .card h3 {
    font-size: 14px;
    margin-bottom: 10px
  }
  .card-head h3 {
    margin: 0
  }
  h2 {
    font-size: 19px
  }
  .table-wrap th,.table-wrap td {
    padding: 8px 10px;
    line-height: 1.5
  }
  .table-wrap td button {
    min-height: 30px;
    font-size: 12px;
    padding: 4px 8px
  }
  .table-wrap td small {
    font-size: 11px
  }
  .help,.section-note {
    font-size: 11px;
    line-height: 1.6
  }
  .section-note {
    margin: 10px 0
  }
  .pager {
    margin-top: 10px;
    gap: 8px
  }
  details {
    margin-bottom: 10px;
    padding: 9px 12px
  }
  .booking-modes {
    margin-bottom: 12px;
    padding-bottom: 10px;
    gap: 8px
  }
  .booking-modes>span {
    font-size: 11px
  }
  .form-grid {
    gap: 12px 16px
  }
  dialog {
    padding: 20px
  }
  dialog .dialog-head h2 {
    font-size: 19px
  }
  .layout-book {
    gap: 14px
  }
  .cart {
    top: 14px
  }
  .cart form {
    gap: 9px
  }
  .cart-list {
    margin: 10px 0;
    max-height: 240px
  }
  .cart-item {
    padding: 6px 0
  }
  .cart-total {
    font-size: 23px;
    margin: 8px 0
  }
}
.booking-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px
}
.booking-flow strong {
  color: var(--green)
}
.booking-flow>span {
  font-size: 11px;
  color: var(--muted)
}
.booking-period-toolbar {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px
}
.booking-period-toolbar>label {
  flex: 0 0 145px;
  min-width: 135px
}
.booking-period-toolbar .scope-control {
  flex: 0 0 240px;
  min-width: 210px;
  gap: 4px
}
.booking-period-toolbar .scope-control small {
  font-size: 11px;
  line-height: 1.5
}
.booking-period-toolbar .booking-scope-summary {
  flex: 1;
  min-width: 200px;
  display: grid;
  gap: 3px;
  font-size: 12px
}
.booking-scope-summary small {
  font-size: 11px;
  line-height: 1.5
}
.chosen-community-names {
  display: block;
  max-height: 32px;
  overflow: auto
}
.booking-pick-toolbar {
  align-items: end
}
.booking-pick-toolbar>label {
  flex: 0 0 140px;
  min-width: 125px
}
.booking-pick-toolbar>label.wide {
  flex: 1;
  min-width: 180px
}
.booking-pick-toolbar>label:has(#pick-count) {
  flex-basis: 100px;
  min-width: 90px
}
.booking-results-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin: 0 0 10px
}
.booking-period-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px;
  background: #edf4e9;
  border-radius: 6px;
  margin-bottom: 8px;
  flex-shrink: 0;
  font-size: 12px
}
.booking-period-strip small {
  font-size: 11px
}
.booking-query-card>.help {
  margin-top: 4px
}
.cart .between h3 {
  margin: 0
}
dialog:has(#resource-picker-form) {
  width: min(1200px,96vw);
  max-height: 94vh
}
#dialog-body:has(#resource-picker-form) {
  display: flex;
  flex: 1;
  overflow: hidden
}
#resource-picker-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  height: calc(94vh - 110px);
  max-height: calc(94vh - 110px)
}
#resource-picker-form>.help {
  font-size: 12px;
  margin-bottom: 10px;
  flex-shrink: 0
}
#resource-picker-form>.toolbar {
  flex-shrink: 0;
  margin-bottom: 10px
}
#resource-picker-count {
  font-size: 12px;
  white-space: nowrap
}
#resource-picker-form .community-picker-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 140px;
  max-height: none;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px
}
#resource-picker-form .community-option {
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) 180px;
  column-gap: 14px;
  align-items: center;
  flex-shrink: 0;
  min-height: 60px;
  padding: 9px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: white
}
#resource-picker-form .community-option:last-child {
  border-bottom: 0
}
#resource-picker-form .community-option:has(input:checked) {
  background: #edf4e9;
  box-shadow: inset 3px 0 #468164
}
#resource-picker-form .community-option input {
  margin: 0
}
#resource-picker-form .community-line-main {
  display: grid;
  gap: 3px
}
#resource-picker-form>.actions {
  flex-shrink: 0;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line)
}
@media(max-width:700px) {
  .booking-period-toolbar>label {
    flex: 1;
    min-width: 125px
  }
  .booking-period-toolbar .scope-control,.booking-period-toolbar .booking-scope-summary {
    flex-basis: 100%
  }
  .booking-pick-toolbar>label,.booking-pick-toolbar>label.wide {
    flex: 1;
    min-width: 125px
  }
  .booking-flow>span {
    line-height: 1.7
  }
  #resource-picker-form .community-option {
    grid-template-columns: 20px minmax(0,1fr)
  }
  #resource-picker-form .community-line-side {
    grid-column: 2;
    justify-items: start
  }
}

#nav :is(button,a) {
  background: transparent
}
#nav [aria-current="page"] {
  background: #e6eee3;
  color: #245c45;
  font-weight: 700
}

/* Align the two date fields and community selector as one labeled control row. */
.booking-period-toolbar {
  align-items: start
}
.booking-period-toolbar>label {
  line-height: 18px;
  gap: 5px
}
.booking-period-toolbar .scope-control {
  display: grid;
  grid-template-rows: 18px 34px;
  align-content: start;
  gap: 5px
}
.booking-period-toolbar .scope-control>.scope-caption {
  font-size: 12px;
  line-height: 18px;
  max-height: 18px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #53695b
}
.booking-period-toolbar .scope-control>button {
  justify-self: stretch;
  align-self: stretch;
  width: 100%;
  height: 34px;
  min-height: 34px;
  margin: 0;
  padding: 6px 10px;
  line-height: 20px
}
@media(max-width:700px) {
  .booking-period-toolbar .scope-control {
    grid-template-rows: 18px 44px
  }
  .booking-period-toolbar .scope-control>button {
    height: 44px;
    min-height: 44px
  }
}
/* The map opens only while choosing a center; it does not shrink the community list. */
#community-picker-form {
  position: relative
}
.target-search-row {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px
}
.target-search-row>label {
  flex: 1;
  max-width: 470px
}
.target-search-row>.help {
  flex: 1;
  align-self: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}
.target-search-row>button {
  height: 34px;
  min-height: 34px;
  font-size: 12px
}
.coordinate-advanced {
  margin: 8px 0;
  padding: 6px 9px;
  background: #fff
}
.coordinate-advanced>summary {
  font-size: 11px!important;
  font-weight: 400!important
}
.coordinate-advanced>.form-grid {
  padding-top: 8px
}
.map-picker-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden
}
.map-picker-overlay iframe {
  width: 100%;
  height: 100%;
  border: 0
}
#geo-criteria .target-search-row .help {
  margin: 0
}
@media(max-width:700px) {
  .target-search-row {
    flex-wrap: wrap
  }
  .target-search-row>label {
    min-width: 170px
  }
  .target-search-row>.help {
    flex-basis: 100%
  }
  .target-search-row>button {
    min-height: 40px;
    height: 40px
  }
}
/* Period utilization: compact controls, readable location rows and a fixed percentage scale. */
.usage-section {
  margin-bottom: 28px
}
.usage-controls .card-head {
  flex-wrap: wrap
}
.usage-filter-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 10px 16px
}
.usage-filter-grid label {
  min-width: 0
}
.usage-filter-grid button {
  width: 100%;
  text-align: left
}
.usage-filter-bottom {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px
}
.usage-filter-bottom>label {
  width: 200px
}
.usage-filter-bottom>small {
  flex: 1;
  min-width: 220px;
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6
}
.usage-applied {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  margin: 12px 0
}
.usage-applied>span {
  color: var(--muted)
}
.usage-applied>button {
  margin-left: auto
}
.usage-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 12px;
  margin-bottom: 14px
}
.usage-kpis>div {
  background: #edf3e9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 0
}
.usage-kpis small {
  display: block;
  color: var(--muted);
  font-size: 11px
}
.usage-kpis b {
  font-size: 25px;
  line-height: 1.7;
  white-space: nowrap;
  font-variant-numeric: tabular-nums
}
.usage-kpis>div:last-child b {
  font-size: 21px
}
.usage-chart {
  min-width: 0
}
.usage-chart .card-head {
  flex-wrap: wrap
}
.usage-exports {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}
.usage-legend {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 12px
}
.usage-legend>small {
  margin-left: auto;
  font-size: 11px
}
.usage-gradient {
  width: 95px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(90deg,#f2f5ef,#c0d6ba,#6f9b71,#245c45)
}
.usage-table-scroll {
  overflow: auto;
  max-height: 60vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  isolation: isolate
}
.usage-table {
  font-size: 12px;
  white-space: nowrap;
  width: 100%
}
.usage-table th,.usage-table td {
  padding: 6px 8px;
  min-width: 112px
}
.usage-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 305px;
  min-width: 305px;
  max-width: 380px;
  white-space: normal;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
  text-align: left;
  color: var(--ink)
}
.usage-table thead {
  position: sticky;
  top: 0;
  z-index: 4
}
.usage-table thead th {
  background: #f3f6ef;
  white-space: nowrap
}
.usage-table thead th:first-child {
  background: #f3f6ef;
  z-index: 5
}
.usage-table th small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 3px
}
.usage-table td {
  text-align: center;
  font-variant-numeric: tabular-nums
}
.usage-table .usage-total th,.usage-table .usage-total td {
  background: #f7f9f5;
  font-weight: 600
}
.usage-table .usage-location {
  background: none;
  border: 0;
  text-align: left;
  white-space: normal;
  min-height: 24px;
  padding: 0;
  font-weight: 600;
  color: var(--green);
  font-size: 12px
}
.usage-table .usage-heat {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-radius: 5px;
  color: #21432c;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums
}
.usage-table .usage-heat:disabled {
  opacity: 1;
  cursor: default
}
.usage-heat.heat-0 {
  background: #f2f5ef
}
.usage-heat.heat-1 {
  background: #e8efdf
}
.usage-heat.heat-2 {
  background: #dce7d2
}
.usage-heat.heat-3 {
  background: #ccdfc2
}
.usage-heat.heat-4 {
  background: #bad2ae
}
.usage-heat.heat-5 {
  background: #a5c39a
}
.usage-heat.heat-6 {
  background: #8eaf83
}
.usage-heat.heat-7 {
  background: #72996d;
  color: #fff
}
.usage-heat.heat-8 {
  background: #57845b;
  color: #fff
}
.usage-heat.heat-9 {
  background: #3c704d;
  color: #fff
}
.usage-heat.heat-10 {
  background: #245c45;
  color: #fff
}
.usage-heat.heat-none {
  background: #f1f1ef;
  color: var(--muted)
}
.usage-community-list {
  max-height: 48vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px
}
.usage-community-list>label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px
}
.usage-community-list>label[hidden] {
  display: none
}
.usage-community-list>label:last-child {
  border: 0
}
.usage-community-list>label:has(input:checked) {
  background: #edf4e9
}
.usage-community-list>label>span {
  flex: 1
}
.usage-community-list small {
  color: var(--muted);
  font-size: 11px
}
#usage-community-count {
  font-size: 12px;
  white-space: nowrap
}
@media(max-width:900px) {
  .usage-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .usage-kpis {
    grid-template-columns: 1fr 1fr
  }
  .usage-kpis>div:last-child {
    grid-column: 1/-1
  }
  .usage-legend>small {
    margin-left: 0
  }
  .usage-table th:first-child {
    min-width: 220px;
    max-width: 270px
  }
}
@media(max-width:500px) {
  .usage-filter-bottom>label {
    width: calc(50% - 6px)
  }
  .usage-filter-bottom>button {
    width: 100%
  }
  .usage-applied>button {
    margin-left: 0
  }
  .usage-table th:first-child {
    min-width: 170px;
    max-width: 220px
  }
  .usage-kpis b {
    font-size: 22px
  }
}

.region-bar .community-status-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
  margin-right: 4px
}
.region-bar .community-status-field select {
  height: 30px;
  min-height: 30px;
  padding: 4px 28px 4px 8px;
  font-size: 12px;
  width: 150px
}
.usage-filter-bottom>label {
  width: 175px
}
@media(max-width:500px) {
  .usage-filter-bottom>label {
    width: calc(50% - 6px)
  }
}

.usage-table th .usage-sort-head {
  display: block;
  width: 100%;
  padding: 4px 0;
  min-height: 30px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  font: inherit;
  white-space: nowrap
}
.usage-sort-head>span {
  display: inline-block;
  color: #7f9988;
  font-size: 12px
}
.usage-table th[aria-sort=ascending],.usage-table th[aria-sort=descending] {
  background: #e6eee3;
  color: #245c45
}
.usage-table th[aria-sort=ascending] .usage-sort-head>span,.usage-table th[aria-sort=descending] .usage-sort-head>span {
  color: #245c45;
  font-weight: 700
}
.usage-sort-head:hover {
  text-decoration: underline
}
.usage-sort-head:focus-visible {
  outline: 2px solid #468164;
  outline-offset: 2px
}

/* Resource ledger starts at communities; each lower level has its own list. */
.community-poi-input label,
.community-poi-review input,
.community-poi-review select {
  min-width: 0;
}

.community-poi-input [data-poi-result]:empty {
  display: none;
}

.community-poi-review select,
.community-poi-review td input {
  width: 100%;
  max-width: 38rem;
}

.community-poi-review td > * + * {
  margin-top: 4px;
}

.ledger-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}
.ledger-filters {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap
}
.ledger-filters>label {
  min-width: 140px;
  flex: 0 0 185px
}
.ledger-filters>label.ledger-search {
  flex: 0 1 160px;
  min-width: 150px;
  max-width: 190px
}
.ledger-filters>button {
  white-space: nowrap
}
.ledger-page .card-head {
  flex-wrap: wrap
}
.ledger-page .card-head small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400
}
.ledger-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 2px 0 12px;
  font-size: 12px
}
.ledger-breadcrumb>button {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 12px
}
.ledger-breadcrumb>small {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px
}
.ledger-actions {
  white-space: normal;
  min-width: 210px
}
.ledger-actions>button {
  margin: 2px 4px 2px 0
}
.ledger-page .table-wrap {
  max-height: 65vh;
  overflow: auto
}
.ledger-page .table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 1
}
.ledger-page td:first-child {
  min-width: 240px;
  white-space: normal;
  max-width: 460px
}
.ledger-page td small {
  line-height: 1.6
}
.ledger-page td.number {
  min-width: 105px
}
#ledger-picker-count {
  white-space: nowrap;
  font-size: 12px
}
@media(max-width:700px) {
  .ledger-filters>label {
    flex: 1;
    min-width: 140px
  }
  .ledger-filters>label.ledger-search {
    flex: 1 1 200px;
    max-width: none
  }
  .ledger-breadcrumb>small {
    margin-left: 0
  }
  .ledger-page td:first-child {
    min-width: 190px
  }
  .ledger-tools {
    width: 100%
  }
  .ledger-page .table-wrap {
    max-height: 65vh
  }
}

.ledger-filters>label.ledger-level {
  flex: 0 0 200px;
  min-width: 200px
}

.ledger-page .ledger-open {
  display: block;
  width: 100%;
  text-align: left;
  white-space: normal;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--green);
  cursor: pointer
}
.ledger-open:hover b {
  text-decoration: underline
}
.ledger-open small {
  color: var(--muted)
}

/* Contracts: aligned compact date controls keep the list prominent. */
.contract-filter-grid {
  display: grid;
  grid-template-columns: minmax(180px,1.8fr) minmax(140px,1.1fr) minmax(135px,1fr) minmax(135px,1fr) minmax(125px,1fr) auto;
  gap: 10px;
  align-items: end
}
.contract-filter-grid>button {
  white-space: nowrap
}
.contract-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 12px;
  color: var(--muted)
}
.contract-quick>label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-left: 4px
}
.contract-quick>button {
  min-height: 28px;
  padding: 3px 10px;
  font-size: 12px
}
.contract-quick>small {
  margin-left: auto;
  font-size: 11px
}
.contracts-page .table-wrap {
  max-height: 65vh;
  overflow: auto
}
.contracts-page thead {
  position: sticky;
  top: 0;
  z-index: 1
}
.contracts-page .help {
  margin: 8px 0
}
@media(max-width:1250px) {
  .contract-filter-grid {
    grid-template-columns: repeat(3,minmax(0,1fr))
  }
  .contract-filter-grid>button {
    justify-self: start
  }
}
@media(max-width:700px) {
  .contract-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .contract-keyword {
    grid-column: 1/-1
  }
  .contract-quick>small {
    margin-left: 0;
    flex-basis: 100%
  }
}

.retention-selection {
  max-height: 38vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px
}
.retention-selection>label {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px
}
.retention-selection>label:last-child {
  border: 0
}
.retention-selection small {
  display: block;
  font-size: 11px
}
.retention-counts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0
}
.retention-counts>span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f5f8f2;
  font-size: 12px
}
.retention-counts b {
  margin-left: 6px;
  font-size: 18px
}
.retention-note {
  white-space: normal;
  max-width: 280px;
  min-width: 150px
}
dialog:has(.retention-counts) {
  width: min(1250px,96vw)
}
dialog:has(.retention-counts) .table-wrap {
  max-height: 55vh
}
.position small {
  white-space: normal;
  line-height: 1.5
}

.contract-attention-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px
}
.contract-attention-tabs>button {
  min-height: 32px;
  padding: 5px 14px
}
.contract-attention-tabs>small {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px
}
.contract-attention-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  margin: 12px 0;
  background: #edf3e9;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px
}
.contract-attention-note>span {
  flex: 1;
  min-width: 180px;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}
.contract-attention-note>small {
  color: var(--muted)
}
.contracts-page td small {
  overflow-wrap: anywhere
}
.contract-attention-note+* {
  margin-top: 12px
}

.contract-attention-note>button {
  white-space: nowrap;
  font-size: 12px;
  padding: 5px 10px;
  min-height: 30px
}
.contract-attention-note~.actions small {
  align-self: center
}

/* Compact contract columns, independent install/payment status blocks. */
.contracts-page .contract-filter-grid {
  grid-template-columns: minmax(155px,1.5fr) repeat(6,minmax(108px,1fr)) auto;
  gap: 8px
}
.contracts-page th, .contracts-page td {
  padding: 7px 10px;
  line-height: 1.35;
}
.contracts-page td:first-child {
  width: 22%;
  min-width: 172px;
  max-width: 280px;
}
.contracts-page :is(th, td):is(:nth-child(2), :nth-child(3), :nth-child(4)) {
  width: 1%;
  white-space: nowrap;
}
.contracts-page td:nth-child(2), .contracts-page td:nth-child(4) {
  font-variant-numeric: tabular-nums;
}
.contracts-page td:nth-child(5) {
  width: 1%;
  min-width: 152px;
  max-width: 210px;
  white-space: normal;
}
.contracts-page td:nth-child(6) {
  min-width: clamp(245px, 26vw, 365px);
  white-space: normal;
}
.contracts-page .campaign-dates, .contracts-page .contract-identity {
  gap: 2px;
  line-height: 1.3;
}
.contracts-page .contract-identity {
  max-width: 280px;
  white-space: normal;
}
.contract-number-line {
  display: flex;
  align-items: baseline;
  gap: 2px 5px;
  flex-wrap: wrap;
}
.contract-number-line > .contract-points {
  white-space: nowrap;
}
.contract-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  align-items: center
}
.contract-progress .tag {
  font-size: 11px;
  padding: 2px 7px;
  white-space: nowrap
}
.contract-business-status {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 5px
}
.contract-business-status .tag {
  font-size: 10px;
  padding: 1px 6px
}
.contracts-page .contract-progress {
  gap: 4px;
}
.contracts-page .contract-business-status {
  gap: 4px;
  margin-top: 4px;
}
#dialog-body>.contract-progress {
  margin-top: 12px
}
@media(max-width:1450px) {
  .contracts-page .contract-filter-grid {
    grid-template-columns: repeat(4,minmax(0,1fr))
  }
}
@media(max-width:700px) {
  .contracts-page .contract-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .contracts-page .contract-filter-grid .contract-keyword {
    grid-column: 1/-1
  }
  .contracts-page .contract-attention-tabs>small {
    margin-left: 0
  }
}

.contracts-page td:nth-child(5)>small {
  font-size: 10px;
  line-height: 1.45;
  margin-top: 3px;
  max-width: 240px
}
.contract-row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap
}
.contracts-page .contract-row-actions {
  flex-wrap: wrap;
}
.contracts-page .contract-row-actions button,
.contracts-page .contract-more > summary {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 12px;
  white-space: nowrap;
}
.contracts-page .contract-more {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.contracts-page .contract-more > summary {
  display: flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  cursor: pointer;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.contract-more > summary::-webkit-details-marker {
  display: none;
}
.contracts-page .contract-more > summary:hover,
.contracts-page .contract-more[open] > summary {
  border-color: var(--green);
}
.contract-more > summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.contract-more-panel {
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 6px 18px rgb(25 49 37 / 16%);
}
.contracts-page .table-wrap.contract-more-fallback-space {
  padding-bottom: 174px;
}
.contract-more-panel:not([popover]) {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  width: max-content;
  max-width: calc(100vw - 24px);
  max-height: min(166px, max(90px, calc(65vh - 104px)));
  overflow: auto;
  scroll-margin: 54px 8px 12px;
}
.contracts-page tr:last-child:not(:first-child) .contract-more-panel:not([popover]) {
  top: auto;
  bottom: calc(100% + 4px);
  scroll-margin: 40px 8px 54px;
}
.contracts-page tr:last-child:not(:first-child)
  .contract-more-fallback-down > .contract-more-panel:not([popover]) {
  top: calc(100% + 4px);
  bottom: auto;
  scroll-margin: 54px 8px 12px;
}
.contract-more-panel:popover-open {
  display: grid;
  width: max-content;
  max-width: calc(100vw - 16px);
}
.contract-more-danger {
  display: grid;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.contract-more-panel button {
  text-align: left;
}

@supports (position-area: bottom span-left) and (position-try-fallbacks: flip-block) {
  .contract-more[open] > summary {
    anchor-name: --contract-more-trigger;
  }
  .contract-more-panel[popover] {
    position: fixed;
    position-anchor: --contract-more-trigger;
    position-area: bottom span-left;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
    position-visibility: anchors-visible;
    justify-self: end;
    inset: auto;
    margin: 4px 0;
  }
  .contracts-page tr:last-child:not(:first-child) .contract-more-panel[popover] {
    position-area: top span-left;
  }
}

@media (max-width: 700px), (pointer: coarse) {
  .contracts-page .contract-more > summary {
    min-width: 44px;
    min-height: 44px;
  }
}
.contract-row-actions button:disabled {
  opacity: .55;
  cursor: default
}
.contract-row-actions button:disabled:hover {
  border-color: var(--line)
}

#finance-period {
  width: 160px;
  min-height: 32px;
  margin-left: auto;
  font-size: 12px
}
.card-head:has(#finance-period) {
  gap: 12px;
  align-items: center;
  flex-wrap: wrap
}

/* Installation and availability exports share the same field picker and preview. */
.export-context,.export-settings,.export-preview-head,.export-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap
}
.export-context {
  margin-bottom: 14px
}
.export-context button {
  margin-left: auto
}
.export-scope {
  max-width: 540px
}
.export-options {
  margin: 12px 0;
  padding: 12px 16px;
  background: #f5f7f2;
  border: 1px solid var(--line,#dbe4d9);
  border-radius: 10px
}
.export-options summary {
  font-weight: 600;
  cursor: pointer
}
.export-field-list {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(145px,1fr));
  gap: 10px 16px;
  margin: 15px 0
}
.export-field-list label,.export-settings label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 14px
}
.export-field-list input,.export-settings input {
  flex: 0 0 auto;
  margin: 0
}
.export-settings select {
  width: auto;
  min-width: 120px;
  height: 36px
}
.export-settings button {
  min-height: 34px;
  padding: 6px 12px
}
.export-preview-head {
  justify-content: space-between;
  margin: 8px 0
}
.export-table {
  max-height: 40vh;
  overflow: auto
}
.export-table table {
  width: max-content;
  min-width: 100%
}
.export-table th,.export-table td {
  padding: 9px 12px;
  white-space: nowrap;
  font-size: 13px
}
.export-table thead {
  position: sticky;
  top: 0;
  background: #f3f6ef;
  z-index: 1
}
.export-footer {
  justify-content: space-between;
  border-top: 1px solid #dbe4d9;
  padding-top: 14px
}
.export-footer p {
  margin: 3px 0
}
.export-footer>div {
  flex: 1;
  min-width: 220px
}
.export-footer>button {
  flex: 0 0 auto
}
.number-edit-list {
  max-height: 55vh;
  overflow: auto
}
.number-edit-list input {
  height: 36px;
  min-width: 140px
}
.number-edit-list td {
  padding: 7px 12px
}
#sheet-export .export-field-list label,#sheet-export .export-settings label {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 7px;
  font-size: 13px
}
#sheet-export .export-field-list .checkbox,#sheet-export .export-settings .checkbox {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  flex: 0 0 18px
}
#sheet-export .export-settings select {
  height: 34px;
  min-height: 34px;
  padding: 4px 8px
}
#sheet-export .export-field-list {
  margin: 12px 0;
  gap: 9px 14px
}
#dialog[open]:has(#sheet-export) {
  display: flex;
  flex-direction: column;
  width: min(1400px,96vw);
  height: 92vh;
  max-height: 92vh;
  overflow: hidden
}
#dialog:has(#sheet-export) #dialog-body {
  flex: 1;
  min-height: 0;
  overflow: hidden
}
#sheet-export {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0
}
#sheet-export .export-context,#sheet-export .export-options,#sheet-export .export-preview-head,#sheet-export .pager,#sheet-export .export-footer {
  flex: 0 0 auto
}
#sheet-export .export-table {
  flex: 1;
  min-height: 100px;
  max-height: none
}
#sheet-export .export-options {
  padding: 10px 14px;
  margin: 6px 0
}
#sheet-export .export-options .help {
  margin: 7px 0 0
}
#sheet-export .export-footer {
  padding-top: 9px;
  gap: 10px
}
#sheet-export .export-footer small {
  font-size: 11px
}
#sheet-export .pager {
  margin: 8px 0
}
#sheet-export .export-preview-head {
  margin: 6px 0
}
#sheet-export .export-preview-head .actions {
  margin: 0
}
#sheet-export .export-context {
  margin-bottom: 6px
}
@media(max-width:750px) {
  #dialog:has(#sheet-export) #dialog-body {
    overflow: auto
  }
  #sheet-export {
    height: auto;
    min-height: 100%
  }
  #sheet-export .export-field-list {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  #sheet-export .export-table {
    min-height: 230px;
    max-height: 45vh
  }
  #sheet-export .export-options {
    padding: 8px
  }
}

#sheet-export .export-sheet-picker {
  display: flex;
  gap: 14px;
  align-items: center;
  border: 0;
  padding: 0;
  margin: 0
}
#sheet-export .export-sheet-picker legend {
  float: left;
  margin-right: 12px;
  color: var(--ink);
  font-size: 13px
}
#sheet-export .export-sheet-picker label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  white-space: nowrap
}

.number-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px
}
.number-tools span {
  font-size: 12px;
  color: var(--muted)
}
.number-order {
  margin-top: 12px
}
.number-edit-list thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f6ef
}
.number-edit-list td:last-child {
  white-space: normal;
  min-width: 160px
}
dialog:has(#community-numbers-form),dialog:has(#number-import-preview) {
  width: min(1050px,96vw)
}
#number-import-preview>.number-edit-list {
  max-height: 45vh
}

/* Resource status palette: preserve the text label alongside each color. */
.tag.resource-available {
  background: #dff2e4;
  color: #23613c;
  border: 1px solid #a7d4b4
}
.tag.resource-off {
  background: #e7e9ed;
  color: #505b67;
  border: 1px solid #c6cbd2
}
.tag.resource-pending {
  background: #e1edff;
  color: #275cab;
  border: 1px solid #acc8f0
}
.tag.resource-empty {
  background: #ffead1;
  color: #91480b;
  border: 1px solid #edc291
}

/* Contract dates use equal type size; red marks completed business steps. */
.campaign-dates {
  display: grid;
  gap: 4px;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  font-variant-numeric: tabular-nums
}
.campaign-date-row {
  display: grid;
  grid-template-columns: 2em max-content;
  gap: 8px;
  align-items: baseline;
  font-size: inherit;
  white-space: nowrap
}
.campaign-date-row>span,.campaign-date-row time {
  font: inherit;
  color: inherit
}
.campaign-start {
  color: #27684b
}
.campaign-end {
  color: #275cab
}
.contract-date-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 10px 0 14px
}
.contract-date-summary>span {
  font-size: 12px;
  color: var(--muted)
}
.tag.progress-done {
  background: #fde8e7;
  color: #a62b2b;
  border: 1px solid #e6aaaa;
  font-weight: 600
}
.tag.progress-pending {
  background: #e1edff;
  color: #275cab;
  border: 1px solid #acc8f0
}
.tag.progress-muted {
  background: #e7e9ed;
  color: #505b67;
  border: 1px solid #c6cbd2
}
button.progress-complete-button,button.progress-complete-button:disabled {
  color: #a62b2b;
  background: #fde8e7;
  border-color: #e6aaaa;
  opacity: 1
}

.contract-identity {
  display: grid;
  gap: 4px;
  line-height: 1.5
}
.contract-identity .contract-number,.contract-identity .contract-customer {
  font-size: 13px;
  color: var(--ink);
  overflow-wrap: anywhere
}
.contract-identity .contract-customer {
  font-weight: 500
}
.contract-identity .contract-points {
  font-size: 11px;
  color: var(--muted);
  margin: 0
}
:root #dialog:has(#media-batch-form),:root #dialog:has(#media-batch-result) {
  width: min(1120px,96vw);
  max-height: 92vh
}
#dialog:has(#media-batch-form) #dialog-body {
  overflow: visible
}
#media-batch-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0
}
.media-batch-intro {
  display: flex;
  gap: 20px;
  align-items: end
}
.media-community-label {
  width: min(540px,60%)
}
.media-batch-intro>.help {
  flex: 1;
  font-size: 12px;
  line-height: 1.7;
  margin: 0 0 6px
}
.media-community-picker {
  position: relative
}
#media-community-options {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 5;
  max-height: 260px;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px #17372e20;
  padding: 5px
}
#media-community-options button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 13px
}
#media-community-options button[aria-selected=true] {
  background: #e6eee3
}
#media-community-options span {
  font-size: 12px;
  color: var(--muted)
}
#media-community-options .help {
  padding: 8px
}
.media-batch-scroll {
  max-height: 49vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px
}
.media-batch-table {
  table-layout: fixed;
  min-width: 690px
}
.media-batch-table th,.media-batch-table td {
  padding: 8px
}
.media-batch-table th {
  position: sticky;
  top: 0;
  z-index: 1
}
.media-batch-table th:nth-child(1) {
  width: 56px
}
.media-batch-table th:nth-child(2),.media-batch-table th:nth-child(3),.media-batch-table th:nth-child(4) {
  width: 17%
}
.media-batch-table th:last-child {
  width: 100px
}
.media-batch-table input {
  height: 36px;
  min-height: 36px;
  padding: 6px 9px;
  font-size: 13px
}
.media-batch-table td.media-row-actions {
  white-space: nowrap
}
.media-row-actions button {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 20px;
  margin: 0 3px 0 0
}
.media-row-actions button:first-child {
  color: var(--green);
  background: #edf4ed
}
.media-row-actions button:last-child {
  color: var(--red)
}
.media-row-number {
  color: var(--muted);
  text-align: center
}
.media-batch-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 4px
}
.media-batch-footer strong {
  font-size: 14px
}
.media-batch-footer .help {
  margin: 4px 0 0;
  font-size: 12px
}
.media-batch-footer button {
  flex-shrink: 0
}
#media-batch-error {
  padding: 9px 12px;
  background: #fcf0ed;
  border-radius: 6px;
  font-size: 13px
}
.media-result-heading {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 6px
}
.media-result-heading strong {
  font-size: 17px
}
.media-result-heading span {
  color: var(--muted)
}
.media-result-scroll {
  max-height: 53vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px
}
.media-result-scroll th {
  position: sticky;
  top: 0
}
.media-result-scroll td:last-child {
  color: var(--green);
  font-variant-numeric: tabular-nums
}
@media(max-width:700px) {
  .media-batch-intro {
    display: block
  }
  .media-community-label {
    width: 100%
  }
  .media-batch-intro>.help {
    margin-top: 8px
  }
  .media-batch-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 10px
  }
  .media-result-heading {
    flex-wrap: wrap;
    gap: 4px
  }
  .media-batch-scroll {
    max-height: 40vh
  }
}
.media-batch-table th:nth-child(2),.media-batch-table th:nth-child(3),.media-batch-table th:nth-child(4) {
  width: 13%
}
.media-batch-table {
  min-width: 820px
}
.media-panel-controls {
  display: grid;
  grid-template-columns: minmax(110px,.9fr) minmax(110px,1.1fr);
  gap: 7px
}
.media-panel-controls select {
  min-width: 0;
  min-height: 36px;
  height: 36px;
  padding: 5px 7px;
  font-size: 12px
}
.media-draft-note {
  font-size: 12px;
  margin: -4px 0 0!important
}
.media-batch-hints {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between
}
.media-batch-hints .help {
  margin: 0;
  font-size: 12px;
  line-height: 1.7
}
.media-batch-hints button {
  white-space: nowrap;
  font-size: 12px;
  padding: 6px 10px
}
#panel-template-manager {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f3;
  padding: 12px
}
#panel-template-manager .help {
  margin: 7px 0;
  font-size: 12px
}
#panel-template-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  max-height: 145px;
  overflow: auto
}
.media-template-row {
  display: flex;
  gap: 6px
}
.media-template-row input {
  height: 34px;
  min-height: 34px;
  font-size: 13px;
  padding: 5px 8px
}
.media-template-row button {
  color: var(--red);
  padding: 4px 9px;
  font-size: 12px;
  flex-shrink: 0
}
.media-template-tools {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 9px
}
.media-template-tools button {
  font-size: 12px;
  padding: 5px 10px
}
#media-batch-form:has(#panel-template-manager:not([hidden])) .media-batch-scroll {
  max-height: 25vh
}
@media(max-width:700px) {
  .media-batch-hints {
    margin-top: 8px
  }
  .media-batch-hints .help {
    margin: 0
  }
  #panel-template-list {
    grid-template-columns: 1fr
  }
}

/* Contract row states retain readable text labels as well as color. */
.contract-row-installed {
  --row-ink:#923c34;
  --row-fill:#fff5f2;
  --row-edge:#be5c50}
.contract-row-pending {
  --row-ink:#245480;
  --row-fill:#f2f7ff;
  --row-edge:#6092c4}
.contract-row-locked {
  --row-ink:#805400;
  --row-fill:#fff9eb;
  --row-edge:#cb922b}
.contract-row-retention {
  --row-ink:#6b3c8e;
  --row-fill:#faf4ff;
  --row-edge:#a074bd}
.contract-row-cancelled {
  --row-ink:#656d69;
  --row-fill:#f3f4f3;
  --row-edge:#9ba39e}
.contracts-page tr[class^="contract-row-"] td,.contract-row-retention td {
  background: var(--row-fill);
  color: var(--row-ink)
}
.contracts-page tr[class^="contract-row-"] td:first-child,.contract-row-retention td:first-child {
  box-shadow: inset 3px 0 var(--row-edge)
}
.contracts-page tr[class^="contract-row-"] .contract-identity :is(b,span,small),.contract-row-retention .contract-identity :is(b,span,small) {
  color: inherit
}
.contract-color-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 16px;
  font-size: 12px
}
.contract-color-legend span {
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid currentColor
}
.legend-installed {
  color: #923c34;
  background: #fff5f2
}
.legend-pending {
  color: #245480;
  background: #f2f7ff
}
.legend-locked {
  color: #805400;
  background: #fff9eb
}
.legend-retention {
  color: #6b3c8e;
  background: #faf4ff
}
.legend-cancelled {
  color: #656d69;
  background: #f3f4f3
}
.tag.retention {
  background: #efe1fa;
  color: #6b3c8e;
  border: 1px solid #d1afe6
}
.retention-contract>.card-head>strong {
  color: #6b3c8e
}
.contract-quick>label:has(select) {
  display: flex;
  align-items: center;
  gap: 8px
}
.contract-quick>label>select {
  width: 155px;
  min-height: 36px
}
.campaign-plan-rows {
  display: grid;
  gap: 12px;
  margin-top: 16px
}
.campaign-plan-row {
  display: grid;
  grid-template-columns: minmax(140px,1fr) minmax(160px,1fr) minmax(150px,1fr) auto;
  gap: 10px;
  align-items: end;
  background: #f5f8f5;
  padding: 14px;
  border: 1px solid #dfe7df;
  border-radius: 10px
}
.campaign-plan-row .campaign-note {
  grid-column: 1/-1
}
.campaign-plan-row label {
  margin: 0
}
@media(max-width:700px) {
  .campaign-plan-row {
    grid-template-columns: 1fr 1fr
  }
  .campaign-plan-row .campaign-note {
    grid-column: 1/-1
  }
}

.route-assignment-row {
  display: grid;
  grid-template-columns: minmax(120px,1fr) minmax(100px,1fr) auto auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px 0;
  border-bottom: 1px solid #dfe7df
}
.route-assignment-row label {
  margin: 0
}
.route-unit-list {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
  gap: 8px;
  padding: 12px
}
.route-unit-list label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px
}
.campaign-plan-row {
  grid-template-columns: minmax(150px,1fr) minmax(180px,1fr) auto
}
@media(max-width:700px) {
  .route-assignment-row {
    grid-template-columns: 1fr 1fr
  }
  .campaign-plan-row {
    grid-template-columns: 1fr 1fr
  }
}

.retention-period-total {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  padding: 12px 16px;
  margin: 10px 0;
  background: #f7f0ff;
  border: 1px solid #e1d0ee;
  border-radius: 10px;
  color: #73429a
}
.retention-period-total strong {
  margin-left: auto
}
.retention-batch-selected {
  background: #f1e4ff
}
.retention-contract h3 {
  margin: 20px 0 10px
}

.level-default-control {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0
}
.level-default-control select {
  flex: 1;
  min-width: 0;
  width: 0
}
.level-default-control button {
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 7px 10px;
  font-size: 12px
}
.ledger-level:has(.level-default-control) {
  min-width: 210px
}
.level-default-control+small {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted)
}

.retention-edition-latest>td:first-child {
  border-left: 5px solid #8d50b4
}
.retention-edition-history>td:first-child {
  border-left: 5px solid #d4b8e8
}
.retention-trigger {
  font-size: .9rem;
  margin-top: 5px;
  overflow-wrap: anywhere
}
.demand-period,.demand-toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  margin: 16px 0
}
.demand-period label {
  min-width: 155px
}
.demand-toolbar label {
  max-width: 220px
}
.booking-demands td {
  padding: 9px 8px
}
.booking-demands td input[type=number] {
  width: 95px
}
.booking-demands td select {
  min-width: 138px
}
.booking-demands .table-wrap {
  max-height: 65vh
}
.booking-demands th {
  position: sticky;
  top: 0
}
.demand-row-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap
}
.demand-row-actions button {
  font-size: 12px;
  padding: 5px 9px
}
.demand-total {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px
}
.demand-checkout {
  margin-top: 18px
}
.demand-checkout #demand-amount {
  display: block;
  font-size: 22px;
  margin-top: 12px
}
#exclusion-editor>button {
  margin: 4px
}
.booking-demands .booking-flow {
  flex-wrap: wrap
}
.booking-demands td small {
  display: block
}

.customer-picker {
  position: relative;
  min-width: 240px
}
.customer-picker label {
  display: block
}
.customer-picker input[name=cust] {
  width: 100%
}
.customer-suggestions {
  position: absolute;
  top: 76px;
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid #cbd9cf;
  border-radius: 12px;
  box-shadow: 0 10px 30px #173f2f25;
  max-height: 320px;
  overflow: auto;
  padding: 5px
}
.customer-suggestions[hidden] {
  display: none
}
.customer-suggestions button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  border: 0;
  border-radius: 7px;
  text-align: left;
  padding: 10px 12px;
  gap: 3px;
  background: white
}
.customer-suggestions button:hover,.customer-suggestions button[aria-selected=true] {
  background: #e6f0e7
}
.customer-suggestions button span {
  font-size: 12px;
  color: #637e70
}
.customer-new-option {
  color: #1f624c!important;
  border-top: 1px solid #e0e7e1!important
}
.customers-page td {
  vertical-align: top
}
.customers-page .actions {
  flex-wrap: wrap
}
.customer-names {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0
}
.customer-name-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.customer-name-item > .tag {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.customer-name-item > button {
  flex: none;
  white-space: nowrap;
}

.customers-page .actions {
  margin: 0;
  gap: 6px;
  justify-content: flex-start
}

.ledger-level-heading,.level-choice-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap
}
.ledger-level-heading small,.level-choice-heading small {
  font-size: 11px;
  font-weight: 400
}
.ledger-filter-actions {
  display: contents
}
.ledger-filter-actions button {
  white-space: nowrap
}
#ledger-form input,#ledger-form select,#ledger-form button {
  height: 36px;
  min-height: 36px
}
.ledger-filters .level-default-control select {
  min-width: 115px;
  width: auto
}
.ledger-filters .level-default-control button {
  padding: 7px 10px
}
@media(max-width:700px) {
  .ledger-filter-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    flex-basis: 100%
  }
  .ledger-filters>label.ledger-level {
    flex: 1 1 200px
  }
}

/* Workspace rhythm: common field heights, gaps and responsive boundaries. */
.card {
  min-width: 0
}
.grid2 {
  grid-template-columns: repeat(2,minmax(0,1fr))
}
.between {
  flex-wrap: wrap
}
.card-head h3 {
  line-height: 1.5
}
.ledger-filters>label.ledger-availability {
  flex: 0 0 175px;
  min-width: 175px
}
.ledger-filters>label.ledger-region {
  flex: 0 0 120px;
  min-width: 120px
}
.ledger-filter-actions button {
  padding-left: 10px;
  padding-right: 10px
}
.demand-period,.demand-toolbar {
  gap: 8px;
  margin: 12px 0
}
.demand-toolbar label {
  max-width: 190px
}
.demand-total {
  gap: 12px;
  padding: 12px;
  background: #f5f8f3
}
.demand-checkout {
  margin-top: 0
}
.customer-suggestions {
  top: 72px
}
.customers-page .toolbar>label {
  flex: 0 1 360px;
  min-width: 220px
}
.customers-page .toolbar {
  align-items: end
}
#dialog-body>h3:first-child,#dialog-body>form>h3:first-child {
  margin-top: 0
}
#dialog-body>form:not(#community-picker-form):not(#resource-picker-form) {
  display: grid;
  gap: 14px
}
#dialog-body>form>.help {
  margin: 0
}
#dialog-body>form>.actions {
  margin-top: 4px
}
#content:has(#config-form) .card>label {
  margin-top: 12px
}
#config-form {
  display: grid;
  gap: 12px;
  margin-top: 12px
}
@media(min-width:701px) {
  .card {
    padding: 16px 18px;
    margin-bottom: 16px
  }
  .card-head {
    margin-bottom: 14px;
    gap: 12px
  }
  .toolbar {
    gap: 10px;
    row-gap: 12px
  }
  .form-grid {
    gap: 14px 16px
  }
  .usage-filter-grid {
    gap: 12px 16px
  }
  .contract-filter-grid {
    row-gap: 12px
  }
  .demand-period input,.demand-toolbar input,.demand-toolbar select,.demand-period button,.demand-toolbar button,#ledger-form input,#ledger-form select,#ledger-form button,#usage-form input:not([type=checkbox]),#usage-form select,#usage-form button,#contract-filter-form input:not([type=checkbox]),#contract-filter-form select,#contract-filter-form .contract-filter-grid>button,#customer-search-form input,#customer-search-form button,.tasks-page .toolbar input,.tasks-page .toolbar select {
    height: 36px;
    min-height: 36px
  }
  .level-default-control button {
    height: 36px;
    min-height: 36px
  }
}
@media(max-width:1150px) {
  .grid2 {
    grid-template-columns: 1fr
  }
}
@media(max-width:700px) {
  .ledger-filters>label.ledger-search,.ledger-filters>label.ledger-availability,.ledger-filters>label.ledger-region {
    flex: 1 1 145px;
    min-width: 130px;
    max-width: none
  }
  #ledger-form input,#ledger-form select,#ledger-form button {
    height: 44px;
    min-height: 44px
  }
  .ledger-filter-actions {
    display: contents
  }
  .ledger-filters .level-default-control select {
    min-width: 115px
  }
  .customers-page .toolbar>label {
    flex: 1;
    min-width: 180px
  }
  .customer-suggestions {
    top: 76px
  }
}

@media(max-width:520px) {
  .usage-filter-grid>label:has([name=level]),.usage-filter-grid>label:has([name=population]) {
    grid-column: 1/-1
  }
  .usage-filter-bottom>label {
    width: 100%
  }
  .usage-filter-bottom>small {
    min-width: 0;
    flex-basis: 100%
  }
}

.booking-demands>.empty {
  padding: 24px 16px;
  margin: 12px 0
}
#config-form .actions {
  margin-top: 0
}
@media(max-width:520px) {
  #ledger-form .ledger-filters>label {
    flex: 1 1 100%;
    max-width: none
  }
  .ledger-filter-actions {
    display: flex;
    flex: 1 0 100%;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start
  }
}
dialog:has(#manual-picker) {
  width: min(1320px,96vw);
  max-height: 94vh
}
#dialog-body:has(#manual-picker) {
  display: flex;
  overflow: hidden;
  min-height: 0;
  height: calc(94vh - 100px)
}
#manual-picker {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  min-width: 0
}
#manual-picker .help {
  margin: 8px 0 0
}
.manual-picker-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0
}
.manual-picker-head>span {
  color: var(--muted)
}
.manual-picker-head>.help {
  flex-basis: 100%
}
.manual-groups {
  flex: 1;
  min-height: 90px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcf9
}
.manual-unit {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line)
}
.manual-unit:last-child {
  border-bottom: 0
}
.manual-unit-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px
}
.manual-unit-head>span {
  font-size: 12px;
  color: var(--muted)
}
.manual-unit-head>.has-selection {
  color: var(--green);
  font-weight: 600
}
.manual-lift {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr);
  gap: 10px;
  align-items: start;
  margin: 8px 0
}
.manual-lift>strong {
  padding-top: 10px;
  font-size: 13px
}
.manual-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(190px,1fr));
  gap: 8px
}
.manual-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: stretch;
  text-align: left;
  white-space: normal;
  background: #fff;
  border: 1px solid #dbe4dc;
  padding: 10px 12px;
  min-width: 0;
  line-height: 1.5
}
.manual-panel {
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none
}
.manual-panel>* {
  pointer-events: none
}
.manual-panel:focus-visible {
  outline: 3px solid #37775d66;
  outline-offset: 2px
}
.manual-panel:hover {
  border-color: #468164;
  background: #f5f9f3
}
.manual-panel.is-selected {
  border: 2px solid #1e654c;
  background: #eaf4ec;
  padding: 9px 11px
}
.manual-panel-top {
  display: flex;
  justify-content: space-between;
  gap: 8px
}
.manual-panel-top>span {
  font-size: 12px;
  color: #406a53
}
.manual-picture {
  font-weight: 500
}
.manual-note {
  font-size: 11px;
  color: #637568
}
.manual-retained {
  color: #7e419c
}
.manual-picked {
  padding: 10px 12px;
  margin: 0;
  flex-shrink: 0
}
.manual-picked>summary {
  font-weight: 600
}
.manual-picked .table-wrap {
  max-height: 145px;
  overflow: auto;
  margin-top: 8px
}
.manual-picked th {
  position: sticky;
  top: 0
}
.manual-picker-footer {
  margin: 0;
  padding-top: 4px;
  flex-shrink: 0;
  flex-wrap: wrap
}
.manual-picker-footer>button {
  white-space: nowrap;
  flex-shrink: 0
}
.manual-picker-footer>span {
  margin-right: auto
}
@media(max-width:700px) {
  #dialog-body:has(#manual-picker) {
    height: calc(94vh - 110px)
  }
  .manual-unit {
    padding: 10px
  }
  .manual-lift {
    grid-template-columns: 1fr;
    gap: 2px
  }
  .manual-lift>strong {
    padding-top: 0
  }
  .manual-panels {
    grid-template-columns: repeat(auto-fit,minmax(145px,1fr))
  }
  .manual-picked .table-wrap {
    max-height: 100px
  }
  .manual-picker-footer {
    gap: 6px
  }
  .manual-picker-footer>span {
    flex-basis: 100%
  }
  .manual-picker-head {
    gap: 4px
  }
}

.contracts-page .contract-filter-grid>button {
  width: 100%;
  justify-self: stretch
}

#dialog-body>form>button {
  width: auto;
  min-width: 96px;
  justify-self: end
}
#dialog-body>.kpis {
  grid-template-columns: repeat(2,minmax(0,1fr));
  margin: 14px 0
}
#dialog-body .between:has(>h3) {
  justify-content: flex-start;
  gap: 8px
}
#dialog-body .between>h3 {
  margin-right: auto
}
@media(max-width:520px) {
  #dialog-body>.kpis {
    grid-template-columns: 1fr
  }
}

/* Allocation history is distinct from the physical on-site hint. */
.manual-history {
  font-size: 12px;
  color: #365f50
}
.selection-strategy {
  min-width: 150px
}

.demand-allocation-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 18px;
  margin: 12px 0;
  padding: 12px 14px;
  background: #f5f8f3;
  border: 1px solid #e2e8df;
  border-radius: 10px
}
.demand-rule-setting {
  display: flex;
  gap: 8px;
  align-items: end;
  min-width: 0
}
.demand-rule-setting label {
  width: 140px
}
.demand-rule-setting button {
  white-space: nowrap
}
.demand-allocation-settings .selection-strategy {
  width: 158px;
  min-width: 150px
}
.demand-allocation-settings select,.demand-allocation-settings button {
  height: 36px;
  min-height: 36px
}
.selection-strategy-hint {
  flex: 1 1 230px;
  align-self: center;
  line-height: 1.7;
  font-size: 12px;
  color: #52695a;
  margin: 0
}
.demand-selection-help {
  margin: 4px 0 12px;
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 12px;
  color: #637568
}
.demand-selection-help summary {
  cursor: pointer;
  width: max-content
}
.demand-selection-help p {
  margin: 6px 0;
  line-height: 1.7;
  max-width: 850px
}
@media(max-width:700px) {
  .demand-allocation-settings {
    gap: 12px;
    padding: 12px
  }
  .demand-rule-setting {
    flex: 1 1 100%
  }
  .demand-rule-setting label {
    flex: 1
  }
  .demand-allocation-settings .selection-strategy {
    flex: 1 1 100%;
    width: auto
  }
  .selection-strategy-hint {
    flex-basis: 100%
  }
}

/* Position-first historical lookup uses the same filter, table and date styles. */
dialog:has(#resource-history) {
  width: min(1380px,96vw)
}
#resource-history-form {
  display: grid;
  gap: 14px
}
.history-scope-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: end
}
.history-community {
  flex: 0 1 360px;
  min-width: 240px
}
.history-community-control {
  display: flex;
  gap: 8px
}
.history-community-control input {
  min-width: 0;
  flex: 1
}
.history-community-control button {
  white-space: nowrap;
  flex: none;
  padding: 7px 10px
}
.history-period {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px
}
.history-period>label {
  width: 154px
}
.history-date-separator {
  align-self: flex-end;
  padding-bottom: 8px;
  color: var(--muted)
}
.history-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-self: end;
  padding: 0 0 8px 6px
}
.history-location-row {
  display: grid;
  grid-template-columns: 88px 88px 112px 140px minmax(160px,200px) 1fr;
  gap: 12px;
  align-items: end
}
.history-location-row label {
  min-width: 0
}
.history-query-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center
}
.history-query-actions button {
  white-space: nowrap
}
.history-toggles label.inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap
}
.history-toggles input.checkbox {
  margin: 0;
  flex: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0
}
#resource-history-form input:not([type=checkbox]),#resource-history-form button {
  height: 36px;
  min-height: 36px;
  font-size: 13px
}
#resource-history-form input:not([type=checkbox]) {
  padding: 7px 10px
}
.history-result-total {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 14px 0
}
.history-result-total span {
  color: var(--muted)
}
.history-record-table {
  overflow: auto;
  max-height: 50vh
}
.history-record-table table {
  min-width: 1100px
}
.history-record-table th {
  position: sticky;
  top: 0;
  background: #f5f8f3;
  z-index: 1
}
.history-record-table td small {
  display: block
}
.history-contract-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--green);
  text-align: left;
  text-decoration: underline
}
.history-return {
  margin-bottom: 14px
}
@media(max-width:1120px) {
  .history-location-row {
    grid-template-columns: 76px 76px 96px 116px minmax(150px,1fr)
  }
  .history-query-actions {
    grid-column: 1/-1;
    justify-content: flex-start
  }
  .history-scope-row {
    gap: 12px
  }
  .history-toggles {
    padding-left: 0
  }
  .history-community {
    flex-basis: 320px
  }
}
@media(max-width:700px) {
  .history-community {
    flex-basis: 100%;
    min-width: 0
  }
  .history-period {
    width: 100%
  }
  .history-period>label {
    flex: 1;
    min-width: 125px;
    width: auto
  }
  .history-toggles {
    flex-basis: 100%;
    padding-bottom: 0
  }
  .history-location-row {
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px
  }
  .history-media-code {
    grid-column: 1/-1
  }
  .history-query-actions {
    grid-column: 1/-1
  }
  .history-result-total {
    flex-wrap: wrap;
    gap: 6px
  }
  .history-record-table {
    max-height: 45vh
  }
}

.contract-edit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 16px 0
}
.contract-edit-toolbar label {
  flex: 1 1 220px;
  max-width: 400px
}
.contract-edit-dates {
  grid-template-columns: repeat(3,minmax(0,1fr))
}
.edit-candidate-selected {
  background: #e6f3ea
}
.kpi>b {
  display: block;
  font-size: 1.2em;
  margin-top: 8px
}
@media(max-width:720px) {
  .contract-edit-dates {
    grid-template-columns: 1fr
  }
  .contract-edit-toolbar label {
    max-width: none
  }
}

.contract-edit-preview {
  min-width: 0;
  overflow-wrap: anywhere
}
.contract-edit-preview .actions {
  flex-wrap: wrap
}
.contract-edit-preview .kpis {
  grid-template-columns: repeat(3,minmax(0,1fr))
}
.contract-edit-preview .kpi b {
  display: block;
  margin-top: 5px;
  font-size: 20px
}
.contract-edit-preview .error {
  background: #fff4f1;
  border: 1px solid #f0cdc5;
  border-radius: 8px;
  padding: 12px;
  margin: 14px 0
}
.contract-edit-preview .error p+p {
  margin-top: 6px
}
@media(max-width:600px) {
  .contract-edit-preview .kpis {
    grid-template-columns: 1fr
  }
  .contract-edit-preview .actions button {
    max-width: 100%
  }
}

#content[aria-busy="true"] {
  cursor: progress
}
.export-loading {
  padding: 48px 24px;
  color: var(--muted);
  text-align: center
}
.export-loading strong {
  display: block;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 10px
}
.export-loading button {
  margin: 14px 6px
}

.contract-execution-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 18px
}
.contract-campaign-section {
  padding: 16px;
  background: #f5f8f5;
  border: 1px solid #dfe7df;
  border-radius: 12px;
  margin: 18px 0 22px
}
.contract-campaign-section .card-head {
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap
}
.contract-campaign-section .actions {
  margin: 0;
  gap: 8px
}
.contract-campaign-section h3 {
  margin: 0
}
.campaign-count {
  color: #27684b
}
.contract-campaign-section table {
  background: white
}
@media(max-width:700px) {
  .contract-campaign-section {
    padding: 12px
  }
  .contract-campaign-section .card-head {
    align-items: flex-start
  }
}

#route-point-picker .route-community {
  padding: 0;
  margin: 0
}
#route-point-picker .route-community>summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  list-style: none;
  min-height: 50px
}
#route-point-picker .route-community>summary::-webkit-details-marker {
  display: none
}
#route-point-picker .route-community>summary::before {
  content: '▸';
  width: 12px;
  flex: 0 0 12px;
  color: var(--muted)
}
#route-point-picker .route-community[open]>summary::before {
  content: '▾'
}
#route-point-picker .route-community>summary:hover {
  background: #f7faf5
}
#route-point-picker .route-community-name {
  flex: 1;
  min-width: 0
}
#route-point-picker .route-community>summary small {
  margin: 0;
  white-space: nowrap
}
#route-point-picker .route-community-status {
  color: var(--green);
  font-weight: 600;
  min-width: 65px;
  text-align: right
}
#route-point-picker .route-unit-list {
  border-top: 1px solid var(--line);
  padding: 12px 15px 15px 47px
}
#route-point-picker .route-unit-list label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px
}
@media(max-width:700px) {
  #route-point-picker .route-community>summary {
    flex-wrap: wrap;
    gap: 7px;
    padding: 11px
  }
  #route-point-picker .route-community-name {
    flex-basis: calc(100% - 65px)
  }
  #route-point-picker .route-community-total {
    margin-left: 39px!important
  }
  #route-point-picker .route-community-status {
    margin-left: auto!important
  }
  #route-point-picker .route-unit-list {
    padding: 10px 12px
  }
}

.route-plan-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap
}
.route-assignment-row {
  grid-template-columns: minmax(180px,1.4fr) minmax(120px,1fr) minmax(100px,1fr) 68px auto auto auto;
  align-items: end
}
.route-color-field input {
  width: 54px;
  height: 36px;
  padding: 3px
}
.route-color-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid #0002;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 7px
}
.route-available-filter {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: auto
}
.route-template-communities {
  max-height: 38vh;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(230px,1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px
}
.route-template-communities label {
  display: flex;
  gap: 8px;
  align-items: center
}
@media(max-width:1100px) {
  .route-assignment-row {
    grid-template-columns: repeat(3,minmax(0,1fr))
  }
  .route-reuse-choice {
    grid-column: 1/-1
  }
}
@media(max-width:700px) {
  .route-assignment-row {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .route-available-filter {
    flex-basis: 100%
  }
  .route-picker-actions {
    flex-wrap: wrap
  }
}

.route-draft-summary {
  font-weight: 600;
  font-size: 15px
}
.route-conflicts {
  background: #fff8ed;
  border-color: #e5cf9a
}
.route-conflicts p {
  margin: 7px 0;
  font-size: 12px
}
.route-assignment-row {
  grid-template-columns: minmax(160px,1.2fr) minmax(130px,1fr) minmax(105px,1fr) 58px auto;
  align-items: end
}
.route-assignment-row>button {
  min-height: 34px
}
.route-assignment-row>button[data-action=route-one-default] {
  grid-column: 1/3;
  justify-self: start
}
.route-assignment-row>button[data-action=route-pick] {
  grid-column: 3/5;
  justify-self: start
}
.route-community-owners {
  display: flex;
  gap: 14px;
  padding: 0 15px 9px 47px;
  flex-wrap: wrap;
  font-size: 12px
}
.route-community-owners:empty {
  display: none
}
.route-community-owners>span {
  display: inline-flex;
  align-items: center
}
.route-community.has-route>summary,[data-unit-choice].has-route {
  background: color-mix(in srgb,var(--route-accent) 10%,white);
  box-shadow: inset 3px 0 var(--route-accent)
}
[data-unit-choice] {
  padding: 7px 9px;
  border-radius: 5px
}
.route-available-filter select {
  width: auto;
  min-width: 145px
}
@media(max-width:700px) {
  .route-assignment-row {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .route-assignment-row>button[data-action=route-one-default],.route-assignment-row>button[data-action=route-pick] {
    grid-column: auto
  }
  .route-community-owners {
    padding-left: 12px
  }
}

.route-review-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center
}
.review-warning {
  color: #995b11;
  font-weight: 600
}
.route-day-table {
  max-height: 42vh;
  overflow: auto
}
.route-day-table th {
  position: sticky;
  top: 0;
  z-index: 1
}
.route-day-table td {
  white-space: nowrap
}
.route-day-table td small {
  display: block;
  color: #945410
}
.route-review-ack {
  display: flex;
  gap: 9px;
  align-items: center;
  font-weight: 600;
  color: #8b541c
}
.route-conflicts>p button {
  padding: 3px 9px;
  margin-left: 8px
}
#route-day-review>details:not(.route-conflicts) {
  margin: 0
}
#route-day-review .route-conflicts {
  max-height: 25vh;
  overflow: auto
}

.route-review-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  font-size: 12px;
  color: #53695b
}
.route-review-legend>span {
  display: inline-flex;
  align-items: center
}

#dialog:has(#route-day-review) {
  width: min(1320px,96vw);
  max-height: 94vh
}
#dialog-body:has(#route-day-review) {
  display: flex;
  overflow: hidden;
  height: calc(94vh - 110px)
}
#dialog-body>form#route-day-review {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  gap: 12px
}
#route-day-review>* {
  flex-shrink: 0
}
#route-day-review>.route-day-table {
  flex: 1;
  min-height: 110px;
  max-height: none
}
#route-day-review>.actions {
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line)
}
#route-day-review>.pager {
  margin: 0
}
#route-day-review #batch-export-status:empty {
  display: none
}
@media(max-height:650px) {
  #dialog-body:has(#route-day-review) {
    overflow: auto
  }
  #dialog-body>form#route-day-review {
    display: grid
  }
  #route-day-review>.route-day-table {
    max-height: 38vh
  }
}

/* Existing-contract additions use the same compact demand and panel language. */
#contract-add-picker {
  min-width: 0
}
.contract-add-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap
}
.contract-add-heading>span {
  color: var(--muted)
}
.contract-add-search,.contract-add-settings {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0
}
.contract-add-search label {
  flex: 1 1 220px;
  max-width: 360px
}
.contract-add-settings label {
  flex: 0 1 210px
}
.contract-add-search button,.contract-add-settings button {
  white-space: nowrap
}
.contract-add-suggestions {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 8px 0
}
.contract-add-suggestions>button {
  width: 100%;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left
}
.contract-add-suggestions small {
  display: block
}
.contract-add-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px
}
.contract-add-footer .actions {
  justify-content: flex-end;
  flex-wrap: wrap
}
.contract-add-footer button {
  white-space: nowrap
}
.allocation-warning {
  background: #fff8e9;
  border: 1px solid #e4c980;
  border-radius: 8px;
  color: #826727;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 12px
}
.allocation-warning p {
  margin: 4px 0
}
.allocation-warning small {
  color: inherit
}
#manual-picker>[data-add-manual-warnings] {
  max-height: 110px;
  overflow: auto;
  flex-shrink: 0
}
#manual-picker>[data-add-manual-warnings]:empty {
  display: none
}
#contract-add-scope-list {
  max-height: 50vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 12px 0
}
.contract-add-scope-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line)
}
.contract-add-scope-row:last-child {
  border-bottom: 0
}
.contract-add-scope-row small {
  display: block
}
.contract-add-scope-row input {
  flex: 0 0 18px
}
.contract-add-scope-row button {
  white-space: nowrap
}
.contract-add-scope-row>span {
  flex: 1;
  min-width: 0
}
#contract-add-picker [data-add-count] {
  min-width: 75px;
  max-width: 100px
}
#contract-add-picker [data-add-rule] {
  min-width: 115px
}
#contract-add-picker td {
  padding: 9px 10px
}
@media(max-width:600px) {
  .contract-add-search label,.contract-add-settings label {
    max-width: none;
    flex: 1 1 150px
  }
  .contract-add-footer .actions {
    justify-content: flex-start
  }
  .contract-add-scope-row {
    gap: 8px;
    padding: 9px
  }
  .contract-add-scope-row button {
    font-size: 11px;
    padding: 6px
  }
}

.contract-add-message {
  background: #edf6ee;
  border: 1px solid #bbd5c0;
  border-radius: 8px;
  color: #2a6447;
  padding: 9px 12px;
  margin: 10px 0;
  font-size: 13px
}

#contract-add-picker>.table-wrap {
  max-height: 42vh;
  overflow: auto
}
#contract-add-picker th {
  position: sticky;
  top: 0;
  z-index: 1
}
.contract-add-footer {
  position: sticky;
  bottom: -1px;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  z-index: 2
}
/* Community-first contract editing with a persistent draft. */
.contract-community-list {
  display: grid;
  gap: 10px
}
.contract-community-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden
}
.contract-community-group>summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  background: #f8faf6
}
.contract-community-group>summary::-webkit-details-marker {
  display: none
}
.contract-community-group>summary:before {
  content: '▸';
  color: var(--green);
  width: 12px;
  flex-shrink: 0
}
.contract-community-group[open]>summary:before {
  content: '▾'
}
.contract-community-group>summary>span {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0
}
.contract-community-group>summary small {
  color: var(--muted);
  font-size: 12px
}
.contract-community-group .contract-community-count {
  margin-left: auto;
  flex-shrink: 0;
  justify-content: flex-end
}
.contract-community-count strong {
  color: var(--green);
  white-space: nowrap
}
.contract-community-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 0
}
.contract-community-group [data-edit-group-body] {
  padding: 0 14px 12px
}
.contract-community-group .table-wrap {
  margin-top: 12px
}
.contract-draft-notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  background: #f5f0fa;
  border: 1px solid #dfd0ec;
  border-radius: 8px;
  padding: 12px 14px
}
.contract-draft-notice>span {
  margin-right: auto;
  color: #704694
}
.contract-edit-footer {
  padding-top: 12px;
  border-top: 1px solid var(--line)
}
@media(max-width:650px) {
  .contract-community-group>summary {
    padding: 12px;
    gap: 6px;
    align-items: flex-start
  }
  .contract-community-group>summary>span {
    display: grid;
    gap: 3px
  }
  .contract-community-group .contract-community-count {
    text-align: right
  }
  .contract-community-group>summary small {
    font-size: 11px
  }
  .contract-community-group [data-edit-group-body] {
    padding: 0 10px 10px
  }
}

.contract-community-group {
  padding: 0
}
#contract-edit-form .contract-edit-toolbar {
  margin: 4px 0
}
#contract-edit-form .contract-edit-dates textarea {
  min-height: 54px;
  height: 54px
}
/* Match each field to its content, without squeezing the surrounding actions. */
.card-head {
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 10px 12px
}
.card-head>h3 {
  flex: 0 0 auto;
  white-space: nowrap;
  margin-right: auto
}
.card-head>button {
  flex: 0 0 auto;
  white-space: nowrap
}
.card-head>small {
  flex: 1 0 100%;
  min-width: 0;
  line-height: 1.6
}
#order-form>.form-grid {
  grid-template-columns: minmax(240px,1fr) minmax(125px,155px) minmax(160px,180px) minmax(130px,165px);
  align-items: start
}
#order-form>.form-grid>div:last-child {
  min-width: 0;
  padding-top: 2px
}
#order-form #demand-amount {
  margin-top: 8px;
  font-size: 23px;
  white-space: nowrap
}
.demand-checkout #order-form .customer-picker {
  min-width: 0
}
#order-form input,#order-form select {
  height: 38px;
  min-height: 38px
}
.customer-suggestions {
  top: calc(100% - 1px)
}
.tasks-page>.toolbar {
  display: grid;
  grid-template-columns: 145px 145px 170px 170px;
  gap: 12px;
  justify-content: start;
  align-items: end
}
.tasks-page>.toolbar>label {
  min-width: 0
}
.tasks-page>.table-wrap+h3 {
  margin-top: 22px;
  margin-bottom: 12px
}
.usage-filter-grid {
  grid-template-columns: repeat(3,minmax(150px,260px));
  justify-content: start
}
.usage-filter-bottom>label {
  width: 175px
}
.usage-filter-bottom>small {
  max-width: 480px
}
.contracts-page .contract-filter-grid {
  max-width: 940px;
  grid-template-columns: minmax(230px,1.5fr) repeat(3,minmax(145px,1fr));
  gap: 10px 12px
}
.contracts-page .contract-filter-grid>button {
  width: auto;
  min-width: 110px;
  justify-self: start
}
.contracts-page .contract-keyword {
  min-width: 0
}
.contract-edit-dates {
  gap: 12px 16px
}
.contract-edit-dates input[type=date] {
  max-width: 190px
}
.contract-edit-dates input[name=price] {
  max-width: 150px
}
.contract-edit-toolbar label {
  flex: 0 1 300px;
  max-width: 300px
}
.contract-community-group>summary {
  gap: 10px
}
.contract-community-group>summary small {
  overflow-wrap: anywhere
}
.route-assignment-row {
  grid-template-columns: minmax(180px,1.2fr) minmax(170px,1fr) minmax(140px,.8fr) 64px max-content;
  gap: 10px 12px
}
.route-assignment-row>label {
  min-width: 0
}
.route-assignment-row>button {
  white-space: nowrap
}
.route-assignment-row>span {
  white-space: nowrap
}
.route-picker-actions {
  flex-wrap: wrap;
  gap: 8px
}
.campaign-plan-row {
  grid-template-columns: 150px 180px minmax(0,1fr);
  gap: 10px 14px
}
.campaign-plan-row>button {
  justify-self: end;
  white-space: nowrap
}
.campaign-plan-row .campaign-note textarea {
  min-height: 58px;
  height: 58px
}
#sheet-export .export-field-list {
  grid-template-columns: repeat(auto-fit,minmax(140px,1fr));
  gap: 10px 14px
}
#sheet-export .export-settings {
  flex-wrap: wrap;
  gap: 10px 14px
}
.pager {
  flex-wrap: wrap
}
.actions {
  flex-wrap: wrap
}
@media(min-width:1600px) {
  .contracts-page .contract-filter-grid {
    max-width: none;
    grid-template-columns: minmax(230px,1.8fr) repeat(6,minmax(130px,1fr)) max-content
  }
}
@media(max-width:1120px) {
  #order-form>.form-grid {
    grid-template-columns: minmax(0,1fr) 180px
  }
  .tasks-page>.toolbar {
    grid-template-columns: repeat(2,minmax(145px,190px))
  }
  .usage-filter-grid {
    grid-template-columns: repeat(3,minmax(0,1fr))
  }
  .route-assignment-row {
    grid-template-columns: repeat(3,minmax(0,1fr))
  }
  .route-reuse-choice {
    grid-column: 1/-1
  }
  .route-assignment-row>button[data-action=route-one-default],.route-assignment-row>button[data-action=route-pick] {
    grid-column: auto
  }
  .contracts-page .contract-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
    max-width: 760px
  }
}
@media(max-width:700px) {
  .side-foot {
    flex-wrap: wrap;
    gap: 6px 10px
  }
  .card-head {
    align-items: flex-start;
    gap: 8px
  }
  .card-head>h3 {
    flex-basis: 100%
  }
  .card-head>button {
    max-width: 100%
  }
  .usage-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .route-assignment-row {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .route-reuse-choice {
    grid-column: 1/-1
  }
  .campaign-plan-row {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .campaign-plan-row>button {
    grid-column: 2
  }
  .contract-edit-dates input[type=date],.contract-edit-dates input[name=price] {
    max-width: none
  }
  .contract-edit-toolbar label {
    flex: 1 1 100%;
    max-width: none
  }
  #order-form input,#order-form select {
    height: 44px;
    min-height: 44px
  }
  .tasks-page>.toolbar {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .contract-community-group>summary>span {
    min-width: 0
  }
  .contract-community-group>summary>span:first-of-type {
    flex: 1
  }
}
@media(max-width:520px) {
  #order-form>.form-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  #order-form .customer-picker {
    grid-column: 1/-1
  }
  #order-form>.form-grid>label:has(input[type=date]) {
    grid-column: 1/-1
  }
  .contracts-page .contract-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .contracts-page .contract-keyword {
    grid-column: 1/-1
  }
  .usage-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .history-location-row {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .history-location-row .history-media-code,.history-query-actions {
    grid-column: 1/-1
  }
}

/* Unified contract overview, with original records kept within one disclosure. */
.contract-group-detail>.actions {
  justify-content: flex-start;
  margin: 14px 0
}
.contract-group-originals {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  margin: 16px 0
}
.contract-group-originals>summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--green)
}
.contract-group-originals .table-wrap {
  margin-top: 12px
}
.contract-group-originals th,.contract-group-originals td {
  white-space: nowrap
}
.contract-group-detail>.between {
  gap: 8px
}
.contract-group-detail>.between>span {
  color: var(--muted)
}

.password-control {
  display: block;
  position: relative;
  min-width: 0
}
.password-control>input {
  display: block;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding-right: 44px
}
.password-control>.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 6px;
  margin: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  line-height: 1
}
.password-control>.password-toggle svg {
  display: block;
  width: 18px;
  height: 18px;
  pointer-events: none
}
.password-control>.password-toggle:hover,.password-control>.password-toggle[aria-pressed=true] {
  background: #e7f1e8;
  color: var(--green)
}
.password-control>.password-toggle:focus-visible {
  outline: 2px solid #37775d;
  outline-offset: 1px
}

/* Historical-order exclusion search keeps the editor and focus stable. */
#exclusion-picker .exclusion-search-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px
}
#exclusion-picker .exclusion-search-controls label {
  flex: 0 1 230px;
  min-width: 165px
}
#exclusion-picker .exclusion-search-controls .exclusion-search {
  flex: 1 1 280px
}
#exclusion-picker .exclusion-results {
  max-height: 36vh;
  overflow: auto;
  margin: 8px 0 18px
}
#exclusion-picker .exclusion-customer-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 12px
}
#exclusion-picker .exclusion-customer-selection {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px
}
#exclusion-picker td {
  vertical-align: middle
}
#exclusion-picker td small {
  display: block
}
#exclusion-picker .actions {
  position: sticky;
  bottom: 0;
  background: var(--card,#fff);
  padding-top: 12px
}
@media(max-width:700px) {
  #exclusion-picker .exclusion-search-controls label {
    flex: 1 1 100%
  }
  #exclusion-picker .actions {
    position: static
  }
}

.retention-renewal-note {
  display: grid;
  gap: 2px;
}
.retention-renewal-head {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.retention-renewal-head > strong {
  color: #713c9a;
}
.contracts-page .retention-renewal-head > button {
  min-height: 22px;
  padding: 1px 7px;
  font-size: 11px;
  border-radius: 999px;
}
.retention-renewal-note > small {
  white-space: nowrap;
}
.retention-period-overview td {
  vertical-align: top
}
.retention-period-members {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  min-width: 265px
}
.retention-period-members>div {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between
}
.retention-period-members small {
  display: block
}
.retention-period-overview summary {
  cursor: pointer;
  color: var(--green)
}

.retention-period-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px
}
/* The assistant changes only its own transcript and preview while responding. */
.assistant-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 16px
}
.assistant-guide-main,.assistant-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap
}
.assistant-guide-main strong {
  font-size: 15px
}
.assistant-guide .help {
  margin: 0;
  font-size: 13px
}
.assistant-tools button {
  white-space: nowrap
}
.assistant-help {
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  position: relative;
  font-size: 13px;
  color: var(--muted)
}
.assistant-help summary {
  cursor: pointer;
  padding: 8px 4px
}
.assistant-help>div {
  position: absolute;
  right: 0;
  top: 100%;
  width: min(360px,75vw);
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  z-index: 4;
  box-shadow: 0 8px 24px #17372e14
}
.assistant-help p {
  margin: 0 0 12px;
  line-height: 1.65
}
.assistant-help p:last-child {
  margin: 0
}
.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
  grid-template-areas: "compose draft" "history draft";
  grid-template-rows: min-content 1fr;
  gap: 16px;
  align-items: start
}
.assistant-layout>.card {
  margin: 0;
  padding: 20px;
  min-width: 0
}
.assistant-composer {
  grid-area: compose
}
.assistant-composer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}
.assistant-composer-heading label {
  font-size: 17px;
  font-weight: 650;
  margin: 0
}
.assistant-composer-heading output {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap
}
.assistant-example {
  margin: 8px 0 12px;
  font-size: 13px;
  line-height: 1.6
}
.assistant-composer textarea {
  display: block;
  width: 100%;
  min-height: clamp(180px,26vh,260px);
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.7;
  padding: 12px;
  margin: 0 0 12px
}
.assistant-composer textarea[readonly] {
  background: var(--paper)
}
.assistant-compose-actions,.assistant-voice-actions,.assistant-send-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap
}
.assistant-compose-actions {
  justify-content: space-between
}
.assistant-compose-actions button {
  white-space: nowrap
}
.assistant-voice-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px
}
.assistant-voice-actions button[hidden] {
  display: none
}
.assistant-voice-actions button[aria-pressed=true] {
  background: #fbefec;
  border-color: #a3463f;
  color: #8d332d
}
.assistant-send-actions small {
  font-size: 12px
}
.assistant-compose-note {
  display: block;
  font-size: 12px;
  margin-top: 12px
}
.assistant-voice-status {
  margin: 0 0 12px;
  line-height: 1.6;
  font-size: 13px;
  color: var(--green)
}
.assistant-voice-status.error {
  color: #963e37
}
.assistant-history {
  grid-area: history
}
.assistant-history[hidden] {
  display: none
}
.assistant-history>summary {
  cursor: pointer;
  font-weight: 600
}
.assistant-history>summary span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400
}
.assistant-messages {
  max-height: 380px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 4px 0 0
}
.assistant-message {
  padding: 12px;
  border-radius: 12px;
  margin: 0 0 12px;
  max-width: 94%;
  overflow-wrap: anywhere
}
.assistant-message>div {
  white-space: pre-wrap;
  line-height: 1.65
}
.assistant-message>small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted)
}
.assistant-message.from-user {
  background: #e7f0e9;
  margin-left: auto
}
.assistant-message.from-assistant {
  background: #f5f7f3;
  border: 1px solid #e3e8df
}
.assistant-draft {
  grid-area: draft
}
.assistant-draft .table-wrap {
  max-width: 100%;
  overflow: auto
}
.assistant-draft details {
  margin-top: 16px
}
.assistant-totals {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0
}
.assistant-totals strong {
  font-size: 1.3rem
}
.assistant-totals span {
  color: var(--muted)
}
.assistant-placeholder {
  padding: 16px 0;
  line-height: 1.7;
  text-align: left;
  color: var(--muted)
}
.assistant-placeholder h3 {
  color: var(--ink);
  margin: 0 0 12px
}
.assistant-placeholder p {
  margin: 0 0 12px
}
.assistant-placeholder ol {
  margin: 0;
  padding-left: 20px
}
.assistant-placeholder li+li {
  margin-top: 8px
}
@media(max-width:1100px) {
  .assistant-layout {
    grid-template-columns: minmax(0,1fr);
    grid-template-areas: "compose" "draft" "history";
    grid-template-rows: auto auto auto
  }
  .assistant-guide {
    align-items: flex-start
  }
  .assistant-guide-main {
    gap: 4px;
    flex-direction: column;
    align-items: flex-start
  }
  .assistant-placeholder {
    padding: 0
  }
  .assistant-messages {
    max-height: 320px
  }
}
@media(max-width:700px) {
  .assistant-guide {
    padding: 12px;
    flex-direction: column;
    gap: 8px
  }
  .assistant-guide-main {
    flex-direction: row;
    gap: 8px;
    align-items: center
  }
  .assistant-tools {
    width: 100%;
    gap: 8px;
    justify-content: flex-end
  }
  .assistant-tools .assistant-help {
    margin-right: auto
  }
  .assistant-layout>.card {
    padding: 16px
  }
  .assistant-compose-actions {
    align-items: stretch;
    gap: 12px
  }
  .assistant-send-actions small {
    display: none
  }
  .assistant-compose-actions button {
    min-height: 40px
  }
  .assistant-composer textarea {
    min-height: 200px
  }
  .assistant-composer-heading label {
    font-size: 16px
  }
  .assistant-help>div {
    right: auto;
    left: 0
  }
  .assistant-send-actions {
    margin-left: auto
  }
}

/* Shared operating controls: retain business colors and compact desktop density. */
:root {
  --control-height:36px;
  --control-radius:7px;
  --space-control:8px;
  --focus:#37775d;
  --muted:#5d7065}
nav a {
  display: block;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px
}
nav a:focus-visible,button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px
}
input::placeholder,textarea::placeholder {
  color: var(--muted);
  opacity: 1
}
.booking-draft-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px
}
.booking-draft-bar button {
  padding: 5px 10px;
  min-height: 32px
}
.action-error {
  color: var(--red);
  background: #fff3ef;
  padding: 10px 12px;
  margin: 8px 0 14px;
  border: 1px solid #d3aaa1;
  border-radius: 8px;
  font-size: 13px
}
.contract-price-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 18px;
  padding: 12px;
  background: #f3f7f1;
  border-radius: 8px
}
.contract-price-hint small {
  flex-basis: 100%
}
.contract-price-hint span {
  flex: 1;
  min-width: 220px
}
.contract-detail-filter {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px
}
.contract-detail-filter span {
  color: var(--muted);
  font-size: 12px
}
.assistant-revision {
  background: #f2f7f0;
  margin-bottom: 16px
}
.assistant-revision p {
  font-size: 13px;
  margin-top: 6px
}
button[aria-busy=true] {
  cursor: progress
}
button,select,input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]) {
  min-height: var(--control-height)
}
.password-control>.password-toggle {
  min-height: 32px
}
@media(max-width:700px) {
  .brand {
    padding: 14px 16px 8px
  }
  .brand .brand-icon {
    max-width: 170px
  }
  #nav {
    padding: 8px 12px;
    gap: 4px
  }
  nav a {
    padding: 9px 12px;
    min-height: 40px
  }
  .side-foot {
    padding: 8px 16px;
    gap: 4px
  }
  .side-foot button {
    margin: 0;
    padding: 7px 10px
  }
  .booking-draft-bar {
    align-items: flex-start
  }
  .booking-draft-bar span {
    flex: 1
  }
  .booking-draft-bar button {
    flex-shrink: 0
  }
  input,select,textarea {
    font-size: 16px
  }
  main {
    padding-top: 18px
  }
  .ledger-tools {
    gap: 6px
  }
  .ledger-tools button {
    font-size: 13px;
    padding: 7px 10px;
    min-height: 40px
  }
}
@media(prefers-reduced-motion:reduce) {
  button {
    transition: background-color .1s,border-color .1s,color .1s
  }
}

.mobile-nav-toggle {
  display: none
}
@media(max-width:700px) {
  aside {
    position: relative
  }
  .brand.wordmark-brand {
    padding: 12px 16px
  }
  .brand.wordmark-brand .brand-icon {
    width: 150px;
    min-width: 150px;
    height: 48px;
    min-height: 48px
  }
  .brand.wordmark-brand small {
    margin-top: 0
  }
  .mobile-nav-toggle {
    display: block;
    position: absolute;
    right: 16px;
    top: 22px;
    min-height: 40px;
    padding: 7px 14px
  }
  aside:not(.nav-open) #nav,aside:not(.nav-open) .side-foot {
    display: none
  }
  aside.nav-open #nav {
    display: flex
  }
  nav a {
    flex-shrink: 0
  }
  .brand {
    padding-right: 96px
  }
}

/* Scoped search suggestions share the field width and never contain browser history. */
.scoped-search-host {
  position: relative;
  overflow: visible
}
.scoped-search-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 0;
  max-height: 280px;
  overflow: auto;
  overscroll-behavior: contain;
  z-index: 8;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px #17372e14;
  padding: 4px;
  box-sizing: border-box
}
.scoped-search-options [role=option] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: auto!important;
  min-height: 56px!important;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
  line-height: 1.45
}
.scoped-search-options [role=option]>span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0
}
.scoped-search-options strong {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere
}
.scoped-search-options small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  overflow-wrap: anywhere
}
.scoped-search-options .scoped-search-kind {
  flex-shrink: 0
}
.scoped-search-options [role=option]:hover,.scoped-search-options [role=option][aria-selected=true] {
  background: #e6eee3
}
.scoped-search-message {
  padding: 8px 10px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6
}

/* Picker feedback occupies a full row, never a side column beside the form. */
#dialog-body:has(>#community-picker-form),#dialog-body:has(>#resource-picker-form) {
  flex-direction: column
}
#dialog-body:has(>#community-picker-form)>.action-error,#dialog-body:has(>#resource-picker-form)>.action-error {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere
}
#dialog-body>#community-picker-form,#dialog-body>#resource-picker-form {
  flex: 1;
  min-height: 0
}
#community-picker-form .target-search-row>button {
  flex-shrink: 0
}
/* Expanded distance controls keep their own space even with a long result list. */
#community-picker-form>#geo-criteria[open] {
  flex-shrink: 0;
  max-height: min(32vh,300px)
}
/* At short or narrow sizes use one scrolling form, never clip inputs or footer. */
@media(max-height:700px),(max-width:700px) {
  #dialog-body:has(>#community-picker-form) {
    display: block;
    overflow: auto
  }
  #dialog-body>#community-picker-form {
    display: block;
    height: auto;
    max-height: none;
    min-height: 0
  }
  #community-picker-form>#geo-criteria[open] {
    max-height: none
  }
  #community-picker-form>.community-picker-list {
    height: auto;
    max-height: 42vh;
    min-height: 100px;
    overflow: auto
  }
}

/* Compact action rows: notes share the button row without creating extra height. */
.contract-detail-toolbar {
  gap: 6px 8px;
  margin: 12px 0 10px
}
.contract-detail-toolbar>h3 {
  margin: 0 4px 0 0;
  flex: 0 0 auto
}
.contract-detail-toolbar .contract-detail-filter {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  min-width: 0
}
.contract-detail-hint {
  flex: 0 0 auto;
  line-height: 1.4
}
.contract-detail-hint>span {
  display: block;
  white-space: nowrap
}
#dialog:has(.contract-detail-toolbar) {
  width: min(1440px,96vw)
}
@media(min-width:701px) {
  .card-head {
    gap: 8px;
    margin-bottom: 12px
  }
  .card-head>button,.card-head>.actions>button,.compact-toolbar button {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 34px;
    line-height: 1.5
  }
  .card-head>.actions {
    gap: 6px;
    margin: 0
  }
  .contract-detail-toolbar {
    gap: 6px;
    margin-bottom: 10px
  }
  .contract-detail-toolbar button {
    font-size: 13px;
    padding: 6px 8px
  }
  .contract-execution-actions:empty {
    display: none
  }
  .contract-campaign-section {
    padding: 12px 14px;
    margin: 12px 0
  }
  .contract-campaign-section .help {
    margin: 6px 0 0
  }
}
@media(max-width:700px) {
  .contract-detail-toolbar>h3 {
    flex-basis: 100%
  }
  .contract-detail-toolbar .contract-detail-filter {
    flex-wrap: wrap;
    flex-basis: 100%;
    gap: 6px
  }
  .contract-detail-toolbar button {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 13px
  }
  .contract-detail-hint {
    flex-basis: 100%;
    margin: 0 0 4px
  }
  .contract-detail-hint>span {
    display: inline;
    white-space: normal
  }
}
/* Import follows the same task order: map compact columns, query, then choose a customer. */
.import-page .help {
  margin: 8px 0
}
.import-file-card label {
  max-width: 620px
}
.import-source-grid {
  display: grid;
  grid-template-columns: 180px minmax(220px,1fr) 180px;
  gap: 12px;
  margin-bottom: 12px;
  align-items: start
}
.import-map-grid {
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr));
  gap: 10px
}
.import-map-grid label,.import-source-grid label,.import-default-grid label {
  min-width: 0
}
.import-map-grid select {
  overflow: hidden;
  text-overflow: ellipsis
}
.import-default-grid {
  display: grid;
  grid-template-columns: 160px 160px 110px 145px 165px max-content;
  gap: 10px;
  align-items: end
}
.import-default-grid input,.import-default-grid select,.import-map-grid select,.import-source-grid input,.import-source-grid select {
  min-height: 36px;
  height: 36px;
  padding: 6px 9px
}
.import-default-grid>button {
  min-height: 36px;
  white-space: nowrap
}
.import-source-preview {
  margin: 14px 0 0;
  padding: 9px 12px
}
.import-source-preview .table-wrap {
  margin-top: 10px
}
.result-checkout {
  display: flex;
  align-items: start;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line)
}
.result-checkout .customer-picker {
  flex: 1 1 260px;
  min-width: 200px;
  max-width: 420px
}
.result-checkout>label {
  flex: 0 0 170px
}
.result-checkout-actions {
  display: flex;
  align-self: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px
}
.result-checkout>.help {
  flex-basis: 100%;
  margin: 0
}
.assistant-draft .result-checkout .customer-picker {
  flex-basis: 100%;
  max-width: none
}
.assistant-draft .result-checkout-actions {
  width: 100%;
  gap: 8px
}
@media(max-width:1300px) {
  .import-default-grid {
    grid-template-columns: 160px 160px 110px 145px minmax(150px,1fr)
  }
  .import-default-grid>button {
    grid-column: 1/-1;
    justify-self: end
  }
}
@media(max-width:1150px) {
  .import-map-grid {
    grid-template-columns: repeat(3,minmax(0,1fr))
  }
}
@media(max-width:700px) {
  .import-source-grid,.import-map-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .import-source-grid>label:nth-child(2) {
    grid-column: 1/-1;
    grid-row: 2
  }
  .import-default-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .import-default-grid>button {
    justify-self: stretch
  }
  .import-page :is(input,select,button),.result-checkout :is(input,button) {
    min-height: 44px;
    height: auto
  }
  .result-checkout .customer-picker,.result-checkout>label {
    flex: 1 1 100%;
    max-width: none
  }
  .result-checkout-actions>button {
    flex: 1 1 auto
  }
  .import-results .table-wrap {
    max-height: 55vh
  }
}
.import-results .result-checkout,.assistant-draft .result-checkout {
  margin-bottom: 14px
}

/* The board attribute stays next to the media identifier and is not a booking status. */
.panel-code-board {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px
}
.board-label {
  font-size: .9em;
  font-weight: 600;
  color: var(--ink)
}
.board-selection-summary {
  font-size: .9em
}
.board-filter {
  max-width: 240px
}
.ledger-board {
  min-width: 155px
}

.import-default-grid {
  grid-template-columns: repeat(2,minmax(140px,1fr)) 110px 145px 160px 180px
}
.import-default-grid>button {
  grid-column: 1/-1;
  justify-self: end
}
.demand-allocation-settings>.board-filter {
  width: 180px;
  min-width: 150px
}
.ledger-filters>label.ledger-board {
  flex: 0 0 155px;
  min-width: 145px
}
@media(max-width:1300px) {
  .import-default-grid {
    grid-template-columns: repeat(3,minmax(140px,1fr))
  }
}
@media(max-width:700px) {
  .import-default-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .demand-allocation-settings>.board-filter {
    flex: 1 1 100%;
    width: auto;
    max-width: none
  }
  .ledger-filters>label.ledger-board {
    flex: 1 1 145px
  }
  .import-default-grid>button {
    justify-self: stretch
  }
}

.board-register-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end
}
.board-register-fields>label:first-child {
  flex: 0 0 150px
}
.board-register-fields>label:last-child {
  flex: 1 1 260px;
  max-width: 440px
}
.media-batch-table [data-board-status] {
  width: 100px;
  min-width: 90px
}
@media(max-width:700px) {
  .board-register-fields>label:first-child,.board-register-fields>label:last-child {
    flex: 1 1 100%;
    max-width: none
  }
}

.media-batch-table {
  min-width: 900px
}
.media-batch-table th:nth-child(5) {
  width: 116px
}
.media-batch-table th:nth-child(2),.media-batch-table th:nth-child(3),.media-batch-table th:nth-child(4) {
  width: 11%
}
.media-batch-table [data-board-status] {
  height: 36px;
  min-height: 36px;
  padding: 6px 8px;
  font-size: 13px
}

#dialog:has(.board-register-fields) {
  width: min(720px,calc(100vw - 32px))
}

/* Compact location filters shared by contract and retention swaps. */
.swap-plan-fields {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 12px
}
.swap-plan-fields>label {
  flex: 0 1 180px
}
.swap-plan-fields>.swap-reason {
  flex: 1 1 300px
}
.swap-community-row {
  display: flex;
  gap: 10px;
  align-items: end;
  margin: 12px 0
}
.swap-community-row>label {
  flex: 0 1 340px;
  min-width: 0
}
.swap-location-fields {
  display: grid;
  grid-template-columns: repeat(4,minmax(90px,1fr)) minmax(150px,1.5fr) minmax(160px,1.5fr);
  gap: 10px;
  margin: 12px 0
}
.swap-location-fields label {
  min-width: 0
}
.swap-location-fields input,.swap-location-fields select {
  width: 100%;
  min-width: 0
}
.retention-swap .section-note {
  margin: 8px 0 12px
}
.retention-swap .actions {
  margin: 10px 0
}
.history-record-table td>button {
  margin-top: 6px
}
.retention-contract td:last-child button {
  margin: 3px 4px 3px 0
}
.retention-swap table td small {
  display: block
}
@media(max-width:900px) {
  .swap-location-fields {
    grid-template-columns: repeat(3,minmax(0,1fr))
  }
}
@media(max-width:560px) {
  .swap-location-fields {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .swap-plan-fields>.swap-reason {
    flex-basis: 100%
  }
  .swap-community-row>label {
    flex: 1
  }
  .retention-swap .pager {
    flex-wrap: wrap
  }
}

.retention-swap .swap-feedback {
  color: var(--danger,#9b4536);
  max-width: 18em;
  margin-top: 6px;
  white-space: normal
}
.demand-allocation-settings .retention-filter {
  flex: 0 1 14rem;
  min-width: 11rem
}
.selection-impact {
  margin-top: 12px
}
.selection-impact>summary {
  font-weight: 600;
  cursor: pointer
}
.assistant-demand-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px
}
.assistant-demand-tools small {
  color: var(--muted,#61756b)
}
.assistant-saved-demand {
  display: grid;
  gap: 10px;
  margin-bottom: 16px
}
.assistant-saved-demand p {
  margin: 0
}
.assistant-saved-demand button {
  justify-self: start
}
@media(max-width:700px) {
  .demand-allocation-settings .retention-filter {
    flex-basis: 100%
  }
  .assistant-demand-tools button {
    width: 100%
  }
}

/* Community worklists: preserve each section's typography, compress layout only. */
.booking-demands .demand-row-policies {
  display: grid;
  grid-template-columns: 128px 110px;
  align-items: center;
  gap: 8px
}
.booking-demands .demand-row-policies:has([data-demand-exclusion]) {
  grid-template-columns: 128px 110px 128px
}
.booking-demands .demand-row-policies select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
  min-height: 40px;
  padding: 6px 8px
}
.booking-demands td {
  padding: 8px
}
.booking-demands td input[type=number] {
  width: 76px;
  min-width: 76px;
  min-height: 40px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums
}
.booking-demands .demand-row-actions {
  gap: 4px
}
.booking-demands .demand-row-actions button {
  min-height: 40px;
  padding: 6px 8px
}
#contract-add-picker td {
  padding: 8px
}
#contract-add-picker [data-add-count] {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  min-height: 40px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums
}
#contract-add-picker [data-add-rule] {
  width: 128px;
  min-width: 128px;
  min-height: 40px;
  padding: 6px 8px
}
#contract-add-picker .contract-row-actions {
  gap: 4px
}
#contract-add-picker .contract-row-actions button {
  min-height: 40px;
  padding: 6px 8px
}
@media(min-width:701px) {
  #community-picker-form .community-option {
    min-height: 56px;
    padding: 6px 12px
  }
  #resource-picker-form .community-option {
    min-height: 52px;
    padding: 6px 12px
  }
  .usage-community-list>label {
    min-height: 40px;
    padding: 6px 12px
  }
  .contract-add-scope-row {
    min-height: 44px;
    padding: 6px 12px
  }
  .ledger-page td {
    padding-top: 8px;
    padding-bottom: 8px
  }
  .ledger-actions>button {
    margin-top: 2px;
    margin-bottom: 2px;
    padding-top: 6px;
    padding-bottom: 6px
  }
  #route-point-picker .route-community>summary {
    min-height: 44px;
    padding: 8px 12px
  }
}
@media(max-width:700px),(pointer:coarse) {
  .booking-demands .demand-row-policies {
    grid-template-columns: 144px 128px
  }
  .booking-demands .demand-row-policies select,.booking-demands td input[type=number],.booking-demands .demand-row-actions button,#contract-add-picker [data-add-count],#contract-add-picker [data-add-rule],#contract-add-picker .contract-row-actions button {
    min-height: 44px
  }
  #contract-add-picker [data-add-rule] {
    width: 144px;
    min-width: 144px
  }
  #route-point-picker .route-community>summary,.usage-community-list>label {
    min-height: 44px
  }
}

.icp-filing {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5
}
.icp-filing a {
  color: var(--muted);
  text-decoration: none
}
.icp-filing a:hover {
  text-decoration: underline
}

.remember-login {
  display: flex!important;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 8px 0 14px
}
.remember-login[hidden] {
  display: none!important
}
.remember-login input {
  flex: 0 0 auto
}
.audit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px
}
.audit-toolbar label:first-child {
  flex: 1 1 220px;
  max-width: 360px
}
.audit-toolbar label {
  width: 160px;
  margin: 0
}
.audit-toolbar button {
  flex: 0 0 auto
}

/* Keep allocation totals visible beside the working list, without rebuilding its rows. */
.demand-live-summary {
  position: sticky;
  top: 8px;
  z-index: 6;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 12px 0 8px;
  padding: 10px 12px;
  border: 1px solid #dbe6db;
  border-radius: 8px;
  background: #f5f9f2;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 5px #17392e0a
}
.demand-live-summary strong {
  font-size: 14px;
  color: var(--green)
}
.summary-pending {
  color: #876824
}
.summary-ready {
  color: var(--green)
}
.summary-warning {
  color: #a23d32
}
.manual-global-summary {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #f4f8f1;
  font-size: 12px;
  font-variant-numeric: tabular-nums
}
.manual-global-summary strong {
  font-size: 12px
}
.manual-picker-head .manual-global-summary+.help {
  margin-top: 0
}
@media(max-width:700px) {
  .demand-live-summary {
    top: 4px;
    gap: 5px 12px;
    padding: 8px 10px
  }
  .demand-live-summary strong {
    font-size: 13px
  }
  .manual-global-summary {
    gap: 4px 12px
  }
}

/* Usage accounting stays compact; weekly and daily totals use explicit units. */
.usage-retention-breakdown {
  margin: -4px 0 14px;
  padding: 8px 12px;
  border-left: 3px solid #8d65a7;
  background: #f6f1fa;
  color: #614477;
  font-size: 12px;
  line-height: 1.7
}
.usage-retention-breakdown strong {
  font-variant-numeric: tabular-nums
}
.usage-filter-bottom>label {
  flex: 0 1 160px;
  min-width: 130px
}
.usage-filter-bottom>small {
  min-width: 180px
}
.usage-kpis b {
  font-variant-numeric: tabular-nums
}
@media(max-width:520px) {
  .usage-filter-bottom>label {
    flex: 1 1 calc(50% - 12px);
    min-width: 0
  }
  .usage-retention-breakdown {
    font-size: 11px
  }
}

/* Community location review uses the same map as booking without losing the form. */
.community-map-dialog {
  width: min(1120px,94vw);
  height: 84vh;
  max-height: 900px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white
}
.community-map-dialog::backdrop {
  background: #15372f66
}
.community-map-dialog iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0
}
.geo-import-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0
}
.geo-import-options .inline-check {
  display: flex;
  align-items: center;
  gap: 6px
}
.geo-coordinate-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}
.geo-coordinate-actions button {
  min-height: 32px;
  padding: 5px 10px
}

/* Dense desktop workspace: keep existing text/control sizes, reduce empty space. */
@media(min-width:701px) and (pointer:fine) {
  :root {
    --workspace-card-gap:8px;
    --workspace-card-padding:10px 12px;
    --workspace-field-row-gap:6px;
    --workspace-field-column-gap:10px}
  #workspace main {
    padding-top: 20px;
    padding-left: 24px;
    padding-right: 24px
  }
  #workspace main>header {
    margin-bottom: 10px;
    gap: 10px
  }
  #content .card {
    padding: var(--workspace-card-padding);
    margin-bottom: var(--workspace-card-gap)
  }
  #content .card-head {
    margin-bottom: 6px;
    gap: 6px 10px
  }
  #content .card>h3 {
    margin-bottom: 6px
  }
  #content .form-grid,#dialog-body .form-grid {
    gap: var(--workspace-field-row-gap) var(--workspace-field-column-gap)
  }
  #content label,#dialog-body label {
    gap: 4px
  }
  #content .toolbar {
    gap: 8px 10px;
    margin-bottom: 10px
  }
  #content .help,#dialog-body .help {
    margin-top: 6px;
    margin-bottom: 6px
  }
  #content .actions,#dialog-body .actions {
    gap: 8px;
    margin-top: 10px
  }
  #content .grid2,#content .layout-book {
    gap: 12px
  }
  #content .notice {
    padding: 8px 12px;
    margin-bottom: 12px
  }
  #content .kpis {
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 12px
  }
  #content .kpi {
    padding: 14px
  }
  #content .kpi .value {
    margin-top: 8px
  }
  #content .usage-section {
    margin-bottom: 16px
  }
  #content .usage-controls .card-head>small {
    flex: 0 1 auto;
    margin-left: 0
  }
  #content .usage-filter-grid {
    gap: 8px 12px
  }
  #content .usage-filter-bottom {
    gap: 8px 12px;
    margin-top: 8px
  }
  #content .usage-applied {
    gap: 8px 12px;
    margin: 8px 0
  }
  #content .usage-kpis {
    gap: 10px;
    margin-bottom: 10px
  }
  #content .usage-kpis>div {
    padding: 8px 12px
  }
  #content .usage-kpis b {
    line-height: 1.45
  }
  #content .usage-retention-breakdown {
    margin: 0 0 10px;
    padding: 6px 10px
  }
  #content .usage-legend {
    margin: 6px 0 8px
  }
  #content .contract-filter-grid {
    row-gap: 8px
  }
  #content .ledger-filters {
    row-gap: 8px
  }
  #content .booking-modes {
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px
  }
  #content .demand-period,#content .demand-toolbar {
    gap: 8px 10px;
    margin-bottom: 10px
  }
  #content .demand-policy {
    gap: 8px 12px;
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 10px 12px
  }
  #content .demand-live-summary {
    margin: 8px 0;
    padding: 8px 10px;
    gap: 8px 14px
  }
  #content .pager {
    margin-top: 8px;
    padding-top: 4px;
    gap: 8px
  }
  #content .assistant-layout {
    gap: 12px
  }
  #content .assistant-layout>.card {
    margin: 0;
    padding: 14px
  }
  #dialog-body .contract-campaign-section {
    margin: 12px 0;
    padding: 12px
  }
  #dialog-body .contract-execution-actions {
    margin: 8px 0 12px
  }
}

.geo-import-preview td:nth-child(4) {
  min-width: 180px;
  max-width: 380px;
  white-space: normal
}
.geo-import-preview td:nth-child(4) .help {
  margin: 4px 0
}
.geo-import-preview td:nth-child(5) {
  min-width: 175px
}
.geo-import-poi {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.geo-import-poi h4,
.geo-import-poi .help {
  margin: 0 0 8px;
}
.geo-import-preview .geo-import-poi-value {
  min-width: 115px;
  max-width: 175px;
  overflow-wrap: anywhere;
  white-space: normal;
}
.geo-import-poi-value small {
  display: block;
  margin: 3px 0 0;
}
.geo-import-preview td:nth-child(7) {
  max-width: 320px;
  white-space: normal
}
.geo-import-preview details>summary {
  font-size: inherit;
  cursor: pointer
}

@media(min-width:1100px) and (pointer:fine) {
  #resource-import-form .form-grid {
    grid-template-columns: repeat(5,minmax(130px,1fr))
  }
  .resource-import-preview td {
    padding-top: 8px;
    padding-bottom: 8px
  }
}
.resource-import-preview td:nth-child(2) {
  min-width: 170px
}
.resource-import-preview td:last-child {
  max-width: 420px;
  white-space: normal
}
.resource-import-page input[type=file] {
  max-width: 560px
}

.resource-import-issues {
  border: 1px solid #d9a49b;
  background: #fff5f2;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
  scroll-margin-top: 16px
}
.resource-import-issues p {
  margin: 6px 0;
  line-height: 1.5
}
.resource-import-issues .actions {
  gap: 8px;
  flex-wrap: wrap
}
.resource-profile-details {
  margin-top: 4px
}
.resource-profile-details summary {
  cursor: pointer;
  color: var(--muted,#64776b);
  font-size: inherit
}
.resource-profile-details small {
  display: block;
  margin: 3px 0
}
.media-batch-table th:nth-last-child(2),.media-batch-table td:nth-last-child(2) {
  min-width: 130px;
  width: 150px
}
.resource-import-page .form-grid {
  gap: 10px 14px
}

.media-batch-table {
  min-width: 1060px
}
.media-batch-table th:first-child {
  width: 44px
}
.media-batch-table th:nth-child(2) {
  width: 90px
}
.media-batch-table th:nth-child(3) {
  width: 76px
}
.media-batch-table th:nth-child(4) {
  width: 90px
}
.media-batch-table th:nth-child(5) {
  width: 108px
}
.media-batch-table th:nth-child(6) {
  width: 240px
}
.media-batch-table th:nth-last-child(2),.media-batch-table td:nth-last-child(2) {
  width: 210px;
  min-width: 0
}
.media-batch-table th:last-child {
  width: 88px
}
.media-meta-controls {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 7px
}
.media-meta-controls input {
  min-width: 0;
  width: 100%
}
.resource-import-optional {
  margin: 10px 0
}
.resource-import-optional summary {
  cursor: pointer;
  margin-bottom: 8px;
  color: var(--muted)
}

/* Resource ledgers: give numbers/status only the space they need, retain readable text. */
.ledger-table {
  table-layout: fixed;
  min-width: 860px
}
.ledger-table-community {
  min-width: 1000px
}
.ledger-table-panel {
  min-width: 1040px
}
.ledger-col-count {
  width: 54px
}
.ledger-col-number {
  width: 118px
}
.ledger-col-status {
  width: 88px
}
.ledger-col-actions {
  width: 390px
}
.ledger-col-community-code {
  width: 112px
}
.ledger-col-media-code {
  width: 124px
}
.ledger-col-board {
  width: 140px
}
.ledger-table-panel .ledger-col-actions {
  width: 338px
}
.ledger-table :is(th,td) {
  vertical-align: middle
}
.ledger-page .ledger-table td:first-child {
  min-width: 0;
  max-width: none
}
.ledger-page .ledger-table td.number {
  min-width: 0
}
.ledger-page .ledger-status {
  white-space: normal;
  overflow-wrap: anywhere
}
.ledger-table-has-status-history .ledger-col-status {
  width: 134px
}
.ledger-status .ledger-status-date {
  display: block;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  white-space: nowrap;
  font-variant-numeric: tabular-nums
}
.ledger-status .ledger-status-history {
  margin: 0;
  padding: 0;
  border: 0;
  background: none
}
.ledger-status .ledger-status-history>summary {
  display: list-item;
  min-height: 0;
  padding: 0;
  cursor: pointer
}
.ledger-status-history>summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 2px
}
.ledger-status-history>ul {
  list-style: none;
  margin: 3px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums
}
.ledger-status-history li {
  white-space: nowrap
}
.ledger-page .ledger-actions {
  min-width: 0;
  white-space: normal
}
.ledger-row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px
}
.ledger-row-actions>button {
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0
}
.ledger-community-identity {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere
}
.ledger-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 10px
}
.ledger-title-row>.ledger-open {
  width: auto;
  max-width: 100%;
  flex: 0 1 auto
}
.ledger-page .resource-profile-details {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  max-width: 100%;
  min-width: 0;
  font: inherit
}
.ledger-page .resource-profile-details>summary {
  font: inherit;
  font-size: 12px;
  line-height: 1.6;
  padding: 0;
  min-height: 0;
  white-space: nowrap;
  width: max-content;
  max-width: 100%
}
.ledger-page .resource-profile-details[open] {
  flex-basis: 100%;
  width: 100%
}
.resource-profile-details dl {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.6
}
.resource-profile-details dl>div {
  display: flex;
  gap: 4px;
  min-width: 0;
  max-width: 100%
}
.resource-profile-details dt {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 400
}
.resource-profile-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink)
}
@media(min-width:701px) and (pointer:fine) {
  #content :is(th,td) {
    padding-top: 6px;
    padding-bottom: 6px
  }
  #content .ledger-table :is(th,td) {
    padding-left: 8px;
    padding-right: 8px
  }
  #content .ledger-row-actions>button {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px
  }
  #content .ledger-breadcrumb {
    margin: 0 0 6px;
    gap: 6px
  }
  #content .ledger-page .card-head {
    margin-bottom: 6px
  }
  #content .ledger-page .help {
    margin: 4px 0 0
  }
  #content .ledger-tools {
    gap: 4px 6px
  }
  #content .ledger-tools>button {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px
  }
  #content .ledger-table .ledger-title-row>.ledger-open {
    min-height: 24px
  }
  #content .subnav {
    margin: 6px 0;
    gap: 6px
  }
  #content .contract-attention-tabs {
    gap: 6px;
    margin-bottom: 6px
  }
  #content .contract-color-legend {
    gap: 6px;
    margin: 4px 0 6px
  }
  #content .contract-quick {
    gap: 6px;
    margin: 6px 0
  }
  #content .grid2,#content .layout-book {
    gap: 10px
  }
  #content .contract-row-actions {
    gap: 4px
  }
  #content .contract-filter-grid {
    max-width: 1080px;
    grid-template-columns: minmax(220px,1.6fr) repeat(3,minmax(150px,1fr))
  }
  #content .usage-filter-grid {
    grid-template-columns: 150px 150px minmax(235px,1.2fr) minmax(140px,.8fr) minmax(185px,1fr) minmax(190px,1fr);
    gap: 6px 10px
  }
  #content .usage-filter-bottom {
    gap: 6px 10px;
    margin-top: 6px
  }
  #content .usage-filter-bottom>label {
    flex: 0 1 155px;
    min-width: 140px
  }
  #content .usage-filter-bottom>small {
    flex: 1 1 240px;
    min-width: 0
  }
  #content .demand-allocation-settings {
    gap: 8px 12px;
    margin: 8px 0;
    padding: 8px 10px
  }
  #content .toolbar {
    gap: 6px 8px;
    margin-bottom: 8px
  }
  #content .actions {
    gap: 6px;
    margin-top: 8px
  }
  #content .flow {
    gap: 6px;
    margin: 8px 0
  }
  #content .assistant-guide {
    margin-bottom: 8px;
    padding: 10px 12px
  }
  #content .assistant-layout {
    gap: 10px
  }
  #content .assistant-layout>.card {
    padding: 12px
  }
  #dialog-body>form:not(#community-picker-form):not(#resource-picker-form) {
    gap: 10px
  }
  #dialog-body .toolbar {
    gap: 6px 8px;
    margin-bottom: 8px
  }
  #dialog-body .contract-detail-toolbar {
    gap: 6px;
    margin: 6px 0 8px
  }
  #dialog-body .section-note {
    margin: 8px 0;
    padding: 4px 10px
  }
  #dialog-body h3 {
    margin-top: 14px;
    margin-bottom: 8px
  }
}
@media(min-width:701px) and (max-width:1350px) and (pointer:fine) {
  #content .usage-filter-grid {
    grid-template-columns: minmax(145px,1fr) minmax(145px,1fr) minmax(240px,1.4fr)
  }
}
@media(min-width:701px) and (max-width:1120px) and (pointer:fine) {
  #content .usage-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  #content .usage-filter-grid>label:has([name=level]) {
    grid-column: 1/-1
  }
  #content .contract-filter-grid {
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
}
@media(max-width:700px),(pointer:coarse) {
  #content .ledger-row-actions>button {
    min-height: 44px;
    padding: 8px 10px
  }
  #content .ledger-title-row>.ledger-open {
    min-height: 44px;
    display: flex;
    align-items: center
  }
  #content .ledger-page .resource-profile-details>summary {
    min-height: 44px;
    padding: 12px 0;
    display: list-item
  }
}

/* Small-screen operation keeps compact desktop density separate from touch targets. */
.manual-instructions {
  flex-basis: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent
}
.manual-instructions>summary {
  color: var(--muted);
  font-size: 12px
}
@media(max-width:700px),(pointer:coarse) {
  #workspace :is(button,select),#dialog :is(button,select) {
    min-height: 44px
  }
  #content .ledger-breadcrumb button,#mobile-nav-toggle,#close-dialog {
    min-width: 44px;
    min-height: 44px
  }
  #dialog :is(.manual-picked,.manual-instructions)>summary {
    min-height: 44px;
    padding: 10px 0
  }
}
@media(max-width:700px) {
  dialog[open]:has(#manual-picker) {
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 12px;
    display: flex;
    flex-direction: column
  }
  dialog:has(#manual-picker)>.dialog-head {
    flex-shrink: 0;
    margin-bottom: 6px
  }
  #dialog-body:has(#manual-picker) {
    height: auto;
    flex: 1;
    min-height: 0;
    padding: 0
  }
  #manual-picker {
    gap: 6px
  }
  #manual-picker .manual-picker-head {
    gap: 2px;
    font-size: 12px;
    max-height: 42%;
    overflow: auto;
    overscroll-behavior: contain
  }
  #manual-picker .manual-picker-head>strong,#manual-picker .manual-picker-head>span {
    flex-basis: 100%
  }
  #manual-picker .manual-global-summary {
    gap: 2px 8px;
    margin: 2px 0;
    padding: 0;
    font-size: 12px
  }
  #manual-picker .manual-global-summary>span:nth-child(1),#manual-picker .manual-global-summary>span:nth-child(4) {
    display: none
  }
  #manual-picker .manual-groups {
    min-height: 140px;
    flex: 1
  }
  #manual-picker .manual-picked {
    padding: 0 6px;
    max-height: 30%;
    overflow: auto
  }
  #manual-picker .manual-picked .table-wrap {
    max-height: 85px
  }
  #manual-picker .manual-picker-footer {
    display: grid;
    grid-template-columns: 1fr 1fr 1.3fr;
    gap: 4px
  }
  #manual-picker .manual-picker-footer>span {
    grid-column: 1/-1;
    font-size: 12px
  }
  #manual-picker [data-manual-plan-update]:not([hidden]) {
    grid-column: 1/3
  }
  #manual-picker .manual-picker-footer>button {
    padding: 6px;
    white-space: normal;
    font-size: 12px
  }
  #manual-picker [data-action="demand-manual-done"] {
    grid-column: 3;
    grid-row: 2/4
  }
  #dialog-body:has(#community-picker-form) {
    overflow: auto
  }
  #community-picker-form {
    max-height: none;
    min-height: 0
  }
  #community-picker-form>.actions {
    position: sticky;
    bottom: 0;
    background: var(--white);
    padding: 8px 0;
    z-index: 2
  }
  #community-picker-form>.community-picker-list {
    max-height: 45dvh;
    min-height: 120px;
    flex: none
  }
}

@media(max-width:700px),(pointer:coarse) {
  #workspace button,#dialog button {
    min-width: 44px
  }
  #community-picker-form>.actions>button,#community-picker-form>.picker-list-toolbar>button {
    min-height: 44px;
    height: auto
  }
}
@media(max-width:700px) and (max-height:740px) {
  #manual-picker .manual-picker-head {
    max-height: 30%
  }
  #manual-picker .manual-picked {
    max-height: 22%
  }
  #manual-picker .manual-groups {
    min-height: 120px
  }
}

.demand-total-allocation {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin: 8px 0
}
.demand-total-allocation label {
  width: 130px
}
.demand-total-allocation .help {
  margin: 0;
  align-self: center;
  flex: 1;
  min-width: 220px
}

.order-migration .import-source-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end
}
.order-migration .import-source-grid>label:first-child {
  width: 180px
}
.order-migration .import-source-grid>label:last-child {
  width: 100px
}

.route-worker-day td {
  background: var(--soft,#edf2ea);
  padding-block: 6px
}
.route-worker-day-head {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap
}
.route-worker-day-head button {
  margin-inline-start: auto
}

.route-unassigned-table {
  max-height: 18rem;
  overflow: auto;
  margin-block: 8px
}

/* Community occupancy in the management overview */
.overview-tabs {
  display: flex;
  gap: 14px;
  margin: 8px 0 13px;
  border-bottom: 1px solid var(--line)
}
.overview-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  white-space: nowrap
}
.overview-tabs button[aria-selected=true] {
  border-bottom-color: var(--green);
  color: var(--green);
  font-weight: 700
}
.occupancy,.occ-detail {
  --occ-purple:#6b3c8e;
  --occ-purple-bg:#faf4ff;
  --occ-purple-line:#d1afe6;
  --occ-empty:#e8ece5}
.occupancy {
  padding: 14px;
  min-width: 0
}
.occ-form {
  display: grid;
  grid-template-columns: minmax(133px,.9fr) minmax(120px,1fr) minmax(180px,1.65fr) minmax(148px,1fr) auto;
  gap: 9px;
  align-items: end
}
.occ-form label {
  gap: 3px;
  min-width: 0
}
.occ-form :is(input,select,button) {
  min-height: 34px;
  padding: 5px 8px
}
.occ-tools,.occ-quick,.occ-views {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px
}
.occ-tools {
  justify-content: space-between;
  row-gap: 9px;
  margin: 10px 0
}
.occ-quick button,.occ-views button {
  min-height: 30px;
  padding: 3px 9px;
  font-size: 12px;
  white-space: nowrap
}
.occ-quick button {
  border-radius: 18px
}
:is(.occ-quick,.occ-views) button[aria-pressed=true] {
  background: #e8f1e9;
  color: var(--green);
  border-color: #aac6b1;
  font-weight: 700
}
.occ-views {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: clip;
  background: #f8faf6
}
.occ-views button {
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  margin: 1px
}
.occ-summary {
  display: grid;
  grid-template-columns: minmax(110px,.77fr) repeat(3,minmax(135px,1fr));
  gap: 13px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f3
}
.occ-summary-primary>* {
  display: block
}
.occ-summary-primary>strong {
  font-size: 21px;
  color: var(--green);
  line-height: 1.3
}
.occ-summary-primary>strong span {
  font-size: 13px
}
.occ-coverage {
  min-width: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums
}
.occ-metric-name {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600
}
.occ-counts,.occ-rate {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  line-height: 1.4;
  white-space: nowrap
}
.occ-rate strong {
  font-size: 11px;
  color: var(--green)
}
.occ-rate small {
  display: inline;
  font-size: 11px
}
.occ-formal-text {
  color: var(--green)
}
.occ-retention-text {
  color: var(--occ-purple)
}
.occ-bar {
  display: flex;
  height: 6px;
  margin: 4px 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--occ-empty)
}
.occ-bar span {
  flex: 0 1 0;
  min-width: 0
}
.occ-bar .occ-formal,.occ-legend .occ-formal {
  background: var(--green)
}
.occ-bar .occ-retention,.occ-legend .occ-retention {
  background: var(--occ-purple-line)
}
.occ-bar .occ-empty,.occ-legend .occ-empty {
  background: var(--occ-empty)
}
.occ-legend {
  display: flex;
  align-items: center;
  gap: 6px 13px;
  flex-wrap: wrap;
  margin: 8px 0 9px;
  color: var(--muted);
  font-size: 11px
}
.occ-legend span {
  white-space: nowrap
}
.occ-legend small {
  margin-left: auto;
  font-size: 11px
}
.occ-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-radius: 3px
}
.occ-table-wrap {
  max-height: min(64vh,700px)
}
.occ-table {
  white-space: normal;
  table-layout: fixed
}
.occ-table th:first-child {
  width: 14%
}
.occ-table th:nth-child(n+2):nth-child(-n+4) {
  width: 11%
}
.occ-table th:nth-child(5) {
  width: 25%
}
.occ-table th:nth-child(6) {
  width: 18%
}
.occ-table th:last-child {
  width: 10%
}
.occ-table th {
  position: sticky;
  top: 0;
  z-index: 1
}
.occ-table :is(th,td) {
  padding: 7px 8px;
  vertical-align: middle
}
.occ-table td[data-label$="覆盖"],.occ-table td[data-label="广告位面板"] {
  min-width: 108px
}
.occ-table .occ-identity {
  min-width: 124px
}
.occ-identity small,.occ-card-heading small {
  display: block;
  overflow-wrap: anywhere;
  font-size: 11px
}
.occ-name {
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere
}
.occ-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0
}
.occ-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-align: left
}
.occ-chip b {
  white-space: nowrap;
  font-size: 10px
}
.occ-chip.occ-formal,.occ-panel.occ-formal {
  background: #eaf4eb;
  color: var(--green);
  border-color: #bfd8c4
}
.occ-chip.occ-retention,.occ-panel.occ-retention {
  background: var(--occ-purple-bg);
  color: var(--occ-purple);
  border: 1px dashed var(--occ-purple-line)
}
.occ-chip.occ-match {
  outline: 2px solid #a77223;
  outline-offset: 1px
}
.occ-drill {
  padding: 4px 7px;
  white-space: nowrap;
  font-size: 11px;
  color: var(--green)
}
.occ-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,270px),1fr));
  gap: 9px
}
.occ-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer
}
.occ-card:hover {
  border-color: #a9c0b2
}
.occ-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px
}
.occ-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 7px 0;
  padding: 6px 7px;
  border-radius: 5px;
  background: #f5f8f3
}
.occ-card-clients {
  display: grid;
  gap: 6px
}
.occ-more {
  border: 0;
  background: transparent;
  margin: 0;
  padding: 0
}
.occ-more summary {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap
}
.occ-more[open] {
  width: 100%
}
.occ-more .occ-chips {
  margin-top: 4px
}
.occ-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap
}
.occ-results[aria-busy=true] {
  opacity: .75
}
.occ-detail-metrics {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 12px;
  background: #f5f8f3;
  border-radius: 8px;
  margin: 8px 0;
  padding: 8px 10px
}
.occ-detail-list {
  margin-top: 9px
}
.occ-detail-unit {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px
}
.occ-detail-unit h3 {
  margin: 0;
  font-size: 14px
}
.occ-detail-lift h4 {
  margin: 6px 0 3px;
  font-size: 12px;
  color: var(--muted)
}
.occ-panels {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(min(100%,144px),1fr));
  gap: 5px
}
.occ-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  overflow-wrap: anywhere
}
.occ-panel small {
  margin-left: 6px;
  font-size: 10px
}
.occ-panel.occ-empty {
  background: #f3f5f0;
  color: var(--muted)
}
@media(max-width:950px) {
  .occ-form {
    grid-template-columns: repeat(2,minmax(0,1fr)) auto
  }
  .occ-form label:nth-child(3) {
    grid-column: 1/-1;
    grid-row: 1
  }
  .occ-summary {
    grid-template-columns: repeat(3,minmax(0,1fr))
  }
  .occ-summary-primary {
    grid-column: 1/-1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px
  }
  .occ-legend small {
    margin-left: 0
  }
  .occ-table-wrap {
    max-height: none
  }
  .occ-table {
    min-width: 740px
  }
}
@media(max-width:600px) {
  .overview-tabs {
    gap: 7px
  }
  .overview-tabs button {
    padding: 7px 6px
  }
  .occupancy {
    padding: 9px
  }
  .occ-form {
    gap: 6px;
    grid-template-columns: repeat(2,minmax(0,1fr))
  }
  .occ-form button {
    align-self: end
  }
  .occ-summary,.occ-detail-metrics {
    gap: 5px;
    padding: 6px
  }
  .occ-counts {
    font-size: 10px
  }
  .occ-rate small,.occ-rate strong {
    font-size: 10px
  }
  .occ-table,.occ-table tbody {
    display: block;
    min-width: 0
  }
  .occ-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden
  }
  .occ-table tr {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 5px;
    padding: 8px;
    border-bottom: 1px solid var(--line)
  }
  .occ-table tr:last-child {
    border: 0
  }
  .occ-table td,.occ-table td[data-label] {
    min-width: 0;
    border: 0;
    padding: 0
  }
  .occ-table .occ-identity {
    grid-column: 1/-1
  }
  .occ-table td[data-label$="客户"] {
    grid-column: 1/-1;
    display: flex;
    align-items: baseline;
    gap: 6px
  }
  .occ-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: var(--muted)
  }
  .occ-table td[data-label$="客户"]::before {
    flex-shrink: 0
  }
  .occ-quick button,.occ-views button {
    min-height: 34px
  }
  .occ-chip {
    min-height: 27px
  }
  .occ-drill {
    min-height: 32px
  }
}

/* Contextual guidance for business decisions */
.business-help-popup {
  position: fixed;
  inset: auto auto 12px 50%;
  translate: -50% 0;
  margin: 0;
  border: 0;
  z-index: 1400;
  width: max-content;
  max-width: min(280px,calc(100vw - 16px));
  max-height: calc(100vh - 24px);
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--white);
  box-shadow: 0 5px 18px #17372e32;
  font-size: 12px;
  line-height: 1.55;
  animation: business-help-in .12s ease-out
}
.business-help-popup strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px
}
@supports (bottom: anchor(top)) {
  [data-business-help-active] {
    anchor-name: --business-help-anchor;
  }
  .contract-more[open] > summary[data-business-help-active] {
    anchor-name: --contract-more-trigger, --business-help-anchor;
  }
  .business-help-popup {
    position-anchor: --business-help-anchor;
    position-visibility: anchors-visible;
  }
  .business-help-popup[data-side=above] {
    top: auto;
    bottom: calc(anchor(top) + 8px);
  }
  .business-help-popup[data-side=below] {
    top: calc(anchor(bottom) + 8px);
    bottom: auto;
  }
  .business-help-popup[data-align=center] {
    left: anchor(center);
  }
  .business-help-popup[data-align=start] {
    left: 8px;
    translate: none;
  }
  .business-help-popup[data-align=end] {
    right: 8px;
    left: auto;
    translate: none;
  }
  .business-help-popup[data-align=center]:not([data-side=viewport])::after {
    position: absolute;
    left: calc(50% - 4px);
    width: 8px;
    height: 8px;
    content: '';
    background: inherit;
    transform: rotate(45deg);
  }
  .business-help-popup[data-side=above]::after {
    bottom: -4px;
  }
  .business-help-popup[data-side=below]::after {
    top: -4px;
  }
}
@keyframes business-help-in {
  from {
    opacity: 0
  }
  to {
    opacity: 1
  }
}
@media (prefers-reduced-motion:reduce) {
  .business-help-popup {
    animation: none
  }
}
button.business-help-trigger {
  display: none
}
@media (any-hover:none) {
  .business-help-popup {
    pointer-events: none
  }
  button.business-help-trigger {
    display: inline-grid;
    place-items: center;
    align-self: center;
    justify-self: start;
    width: 30px;
    min-height: 30px;
    padding: 0;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    color: var(--green)
  }
}

[data-tag-rows] {
  display: grid;
  gap: 6px;
  max-height: 15rem;
  overflow: auto;
}
[data-tag-row][hidden] {
  display: none;
}
