/* Shared selection treatment. Filled green is reserved for primary actions. */
:root {
  --selection-ink: #245e48;
  --selection-fill: #eaf2ed;
  --selection-border: #d7e5dc;
  --selection-hover: #f0f5f1;
  --selection-focus: #668e79;
}

.gg-desktop-nav {
  align-self: center;
  align-items: center;
  gap: 6px;
}
.gg-desktop-nav > a {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 20px;
  color: #637369;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color .16s, color .16s;
}
.gg-desktop-nav > a.active {
  background: var(--selection-fill);
  color: var(--selection-ink);
  font-weight: 600;
}
.gg-desktop-nav > a.active::after { content: none; }
.gg-desktop-nav > a:hover:not(.active) { background: var(--selection-hover); }
.gg-desktop-nav b { background: #e5ede7; color: #526d5c; }

.gg-channel-tabs,
.gg-source-tabs,
.tabs,
.wa-status-tabs {
  gap: 6px;
  padding: 4px;
  border-bottom: 0;
  scrollbar-width: thin;
}
.gg-channel-tabs { margin: 18px -4px 16px; }
.gg-channel-tabs button,
.gg-source-tabs button,
.tabs button,
.wa-status-tabs button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: transparent;
  color: #66766c;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  transition: background-color .16s, border-color .16s, color .16s;
}
.gg-channel-tabs button.active,
.gg-source-tabs button.active,
.tabs button.active,
.wa-status-tabs button.active {
  background: var(--selection-fill);
  border-color: var(--selection-border);
  color: var(--selection-ink);
  font-weight: 600;
}
.gg-channel-tabs button:hover:not(.active),
.gg-source-tabs button:hover:not(.active),
.tabs button:hover:not(.active),
.wa-status-tabs button:hover:not(.active) {
  background: var(--selection-hover);
  color: var(--selection-ink);
}
.gg-channel-tabs b,
.wa-status-tabs b {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #edf1ee;
  color: #637369;
  font-weight: 500;
  text-align: center;
}
.gg-channel-tabs .active b,
.wa-status-tabs .active b { background: #dbe9e0; color: var(--selection-ink); }

.gg-chip,
.chip,
.channel { border-radius: 16px; }
.gg-chip.active,
.chip.active,
.channel.active {
  background: var(--selection-fill);
  border-color: var(--selection-border);
  color: var(--selection-ink);
}

.admin .wa-nav-children > a {
  border-radius: 8px;
  transition: background-color .16s, color .16s;
}
.admin .wa-nav-children > a.active,
.admin .side-nav > a.active {
  background: #e7efe9;
  color: #214e40;
  box-shadow: none;
  font-weight: 600;
}
.admin .wa-nav-children > a.active:hover,
.admin .side-nav > a.active:hover { background: #e0ebe3; color: #214e40; }

.gg-desktop-nav > a:focus-visible,
.gg-channel-tabs button:focus-visible,
.gg-source-tabs button:focus-visible,
.tabs button:focus-visible,
.wa-status-tabs button:focus-visible,
.gg-chip:focus-visible,
.chip:focus-visible,
.channel:focus-visible {
  outline: 2px solid var(--selection-focus);
  outline-offset: 2px;
}

@media (min-width: 761px) and (max-width: 1050px) {
  .gg-header { gap: 14px; }
  .gg-desktop-nav { gap: 2px; }
  .gg-desktop-nav > a { padding-inline: 9px; font-size: 13px; }
}
@media (max-width: 760px) {
  .gg-channel-tabs { gap: 4px; margin-block: 14px; }
  .gg-channel-tabs button,
  .gg-source-tabs button,
  .tabs button,
  .wa-status-tabs button { min-height: 40px; padding: 9px 11px; font-size: 12px; }
  .wa-status-tabs { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .gg-desktop-nav > a,
  .gg-channel-tabs button,
  .gg-source-tabs button,
  .tabs button,
  .wa-status-tabs button,
  .admin .wa-nav-children > a { transition: none; }
}

/* Keep long forms usable without scrolling away their actions. */
.modal { display: flex; flex-direction: column; overflow: hidden; }
.modal-head { position: static; flex: 0 0 auto; gap: 16px; }
.modal-head h2 { min-width: 0; overflow-wrap: anywhere; }
.modal-head > button { flex: 0 0 auto; }
.modal-body { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
#modal-form { display: flex; flex-direction: column; min-height: 0; }
.modal-fields { padding: 25px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal-footer { flex: 0 0 auto; margin: 0; padding: 16px 25px; background: #fff; }
.modal-footer .btn { min-height: 42px; }
.modal .note.error { margin-top: 16px; overflow-wrap: anywhere; }
.modal .input:focus-visible { outline: 2px solid var(--selection-focus); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: wait; }
.gg-cart-quantity button:disabled { opacity: .35; cursor: not-allowed; }

.admin-menu-backdrop, .admin-menu-close { display: none; }
.has-horizontal-scroll { scrollbar-width: thin; scrollbar-color: #bccdc2 transparent; }
.has-horizontal-scroll::before {
  content: '左右滑动查看完整表格';
  display: block;
  position: sticky;
  left: 0;
  width: fit-content;
  padding: 9px 15px;
  font-size: 11px;
  line-height: 1.5;
  color: #657c6e;
  background: #f3f7f4;
  border-radius: 0 0 8px 0;
}
.has-horizontal-scroll:focus-visible { outline: 2px solid var(--selection-focus); outline-offset: 2px; }
@media (max-width: 760px) {
  .modal-fields { padding: 20px; }
  .modal-footer { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); gap: 10px; }
  .modal-footer .btn { flex: 1; }
  .admin-menu-close { display: inline-flex; position: absolute; top: 20px; right: 12px; min-width: 36px; min-height: 36px; padding: 8px; color: #dce9e1; }
  .admin-menu-close:hover { background: #ffffff14; color: #fff; }
  .admin.menu-open .admin-menu-backdrop { display: block; position: fixed; inset: 0; z-index: 64; border: 0; background: #0b232866; cursor: pointer; }
  .admin.menu-open .sidebar { max-width: calc(100vw - 64px); }
}
