/* admin/admin.css */

@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap');

* { box-sizing: border-box; }

html, body {
  font-family: "Source Code Pro";
  font-optical-sizing: auto;
  font-variant-numeric: tabular-nums;
  height: 100%;
}

body {
  margin: 0;
  /* background-color: #1e1e1e; */
  color: #e0e0e0;
}

body {
  --admin-header-height: 64px;
  --sidebar-width: 240px;
}

body.sidebar-collapsed {
  --sidebar-width: 64px;
}

:root {
  color-scheme: dark;
  /* Match trading-dashboard defaults so “positive/negative” semantics are consistent. */
  --t2g-accent-green: #26a69a;
  --t2g-accent-red: #ef5350;
  --t2g-accent-grey: rgba(255, 255, 255, 0.35);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-toggle {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  width: 40px;
  height: 40px;
  padding: 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.sidebar-toggle-icon {
  display: block;
}

.sidebar-toggle-line {
  transform-origin: left center;
  transform-box: fill-box;
  transition: transform 220ms ease, opacity 220ms ease;
}

.sidebar-toggle-line--top {
  transform: scaleX(1);
}

.sidebar-toggle-line--mid {
  transform: scaleX(0.75);
  opacity: 0.85;
}

.sidebar-toggle-line--bot {
  transform: scaleX(0.55);
  opacity: 0.75;
}

body.sidebar-collapsed .sidebar-toggle-line--top {
  transform: scaleX(0.55);
  opacity: 0.75;
}

body.sidebar-collapsed .sidebar-toggle-line--mid {
  transform: scaleX(0.75);
  opacity: 0.85;
}

body.sidebar-collapsed .sidebar-toggle-line--bot {
  transform: scaleX(1);
  opacity: 1;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.shell {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  position: sticky;
  top: var(--admin-header-height);
  height: calc(100vh - var(--admin-header-height));
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: width 180ms ease;
  z-index: 10;
}

.sidebar-nav {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-subnav {
  padding: 0 12px 12px;
}

body.sidebar-collapsed .sidebar-subnav {
  display: none;
}

/* Subnavs now render inline within the main sidebar nav so they appear directly under their parent tab. */
.sidebar-nav .subnav {
  padding-top: 0;
  border-top: 0;
  padding-left: 40px;
}

.sidebar-nav .subnav-title {
  display: none;
}

body.sidebar-collapsed .sidebar-nav .subnav {
  display: none !important;
}

.subnav {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.subnav.is-active {
  display: flex;
}

.subnav-title {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.72);
  padding: 0 4px;
}

.subtab {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255,255,255,0.92);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}

.subtab:hover {
  background: rgba(255, 255, 255, 0.08);
}

.email-template-toolbar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: flex-end;
}

.email-template-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  flex: 1;
  min-width: 240px;
}

.email-template-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.email-template-actions .btn {
  white-space: nowrap;
}

.email-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.email-template-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-template-label {
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.email-template-pane textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 10, 0.6);
  color: #eaeaea;
  padding: 12px;
  font: inherit;
  line-height: 1.6;
}

.email-template-preview {
  min-height: 360px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #f7f5f0;
  color: #1a1a1a;
  padding: 20px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.email-template-preview h1,
.email-template-preview h2,
.email-template-preview h3 {
  color: #1a1a1a;
  margin: 0 0 12px 0;
  font-weight: 700;
}

.email-template-preview p {
  margin: 0 0 12px 0;
  line-height: 1.6;
}

.email-template-preview ul {
  margin: 0 0 12px 20px;
  padding: 0;
}

.email-template-preview a {
  color: #8b6b2c;
  text-decoration: underline;
}

.email-template-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.email-template-system {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.email-template-vars {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-template-vars__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.email-template-vars__list span {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.78);
}

.pill-tag--marketing {
  border-color: rgba(201, 178, 124, 0.45);
  color: #c9b27c;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.table-actions--row {
  gap: 10px;
}

.email-template-actions-cell {
  width: 42px;
  padding-right: 0;
}

.row-actions-toggle {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255,255,255,0.92);
  border-radius: 8px;
  width: 30px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.row-actions-toggle:hover {
  background: rgba(255, 255, 255, 0.10);
}

.row-actions-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.row-actions-icon {
  width: 14px;
  height: 2px;
  background: rgba(255,255,255,0.82);
  border-radius: 999px;
  position: relative;
  display: block;
}

.row-actions-icon::before,
.row-actions-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255,255,255,0.82);
  border-radius: 999px;
}

.row-actions-icon::before { top: -5px; }
.row-actions-icon::after { top: 5px; }

.email-template-actions-row td {
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.row-actions-panel {
  overflow: hidden;
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: max-height 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.email-template-actions-row.is-open .row-actions-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.row-actions-panel__inner {
  padding: 10px 0 12px;
}

.admin-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.admin-modal.is-open {
  display: flex;
}

.admin-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.admin-modal__panel {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 32px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  background: #111114;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.admin-modal__panel--sm {
  width: min(560px, calc(100% - 32px));
}

.admin-modal__header,
.admin-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-modal__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.admin-modal__title {
  font-size: 18px;
  font-weight: 700;
}

.admin-modal__body {
  padding: 20px 24px 24px;
}

@media (max-width: 980px) {
  .email-template-grid {
    grid-template-columns: 1fr;
  }
}

body.sidebar-collapsed .sidebar-nav {
  padding: 8px;
}

.tab {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  font: inherit;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.tab--side {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
}

.tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  flex: 0 0 auto;
}

.tab-icon-img {
  display: block;
  width: 16px;
  height: 16px;
  opacity: 0.95;
  /* Attempt to normalize icon color for dark UI (works well for black SVGs). */
  filter: brightness(0) invert(1);
}

/* Sidebar toggle (in-rail) should visually match the icon blocks. */
.sidebar .sidebar-toggle {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: #e0e0e0;
  width: 40px;
  height: 40px;
  padding: 6px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar .sidebar-toggle svg { display: block; width: 18px; height: 12px; color: #e0e0e0; }

body.sidebar-collapsed .sidebar .sidebar-toggle { margin: 4px 0; }

.tab-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 160ms ease;
}

body.sidebar-collapsed .tab--side {
  justify-content: center;
  gap: 0;
  padding-left: 8px;
  padding-right: 8px;
}

body.sidebar-collapsed .tab--side .tab-label {
  display: none;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.12);
}

.tab.is-active {
  background: rgba(255, 255, 255, 0.16);
}

.header-cta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-signed-in-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  min-width: 0;
  max-width: 180px;
  font-size: 12px;
  line-height: 1.2;
}

.admin-signed-in-chip__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #b0b0b0;
}

.admin-signed-in-chip__value {
  font-size: 12px;
  font-weight: 600;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.12);
  color: #e0e0e0;
  font-weight: 600;
  font: inherit;
}

.btn:hover { background: rgba(255, 255, 255, 0.16); text-decoration: none; }

.btn-ghost { background: rgba(255, 255, 255, 0.08); }

.main {
  padding: 22px 0 44px;
  flex: 1 1 auto;
  min-width: 0;
}

.form {
  display: grid;
  gap: 12px;
  max-width: 520px;
}

label span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #b0b0b0;
  margin-bottom: 6px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e0e0e0;
  font: inherit;
}

button,
select,
textarea,
input {
  font-family: inherit;
  font-size: inherit;
}

select,
.glass-select {
  width: 100%;
  padding: 10px 40px 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.06);
  color: #e0e0e0;
  font: inherit;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(224,224,224,0.9)' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
}

select:hover,
.glass-select:hover {
  background-color: rgba(255, 255, 255, 0.10);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

select:disabled,
.glass-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Custom "Glass Select" (JS-enhanced). Native <select> stays in DOM for existing logic, but is hidden when JS is enabled. */
body.js .glass-select-wrap {
  position: relative;
  width: 100%;
}

body.js select.glass-select {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.glass-select-btn {
  width: 100%;
  padding: 10px 40px 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: rgba(255, 255, 255, 0.06);
  color: #e0e0e0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  line-height: 1.2;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(224,224,224,0.9)' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
}

.glass-select-btn:hover {
  background-color: rgba(255, 255, 255, 0.10);
}

.glass-select-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.glass-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 2000;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 12, 12, 0.55);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  max-height: min(280px, calc(100vh - 24px));
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 180ms ease;
}

.glass-select-wrap.is-open .glass-select-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.glass-select-wrap.open-up .glass-select-menu {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateY(8px);
}

.glass-select-wrap.open-up.is-open .glass-select-menu {
  transform: translateY(0);
}

.glass-select-options {
  padding: 6px;
  overflow: auto;
  max-height: inherit;
}

.glass-select-option {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font: inherit;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}

.glass-select-option:hover,
.glass-select-option:focus-visible {
  background: rgba(255, 255, 255, 0.10);
  outline: none;
}

.glass-select-option[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.14);
}

.glass-select-option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .glass-select-menu {
    transition: none;
  }
}

.promo-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.promo-code-row input {
  flex: 1 1 auto;
}

.pill-toggle {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  min-width: 110px;
  text-align: center;
  white-space: nowrap;
}

.pill-toggle--code {
  min-width: 0;
  padding: 8px 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.pill-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pill-toggle.is-on {
  border-color: rgba(38, 166, 154, 0.55);
  background: rgba(38, 166, 154, 0.18);
}

.pill-toggle.is-off {
  border-color: rgba(239, 83, 80, 0.55);
  background: rgba(239, 83, 80, 0.14);
}

/* Pill-style checkbox (match homepage Join/Signup) */
.pill-toggle.admin-pill-toggle {
  display: block;
  width: 100%;
  position: relative;
  margin: 0;
  border: 0;
  background: transparent;
  padding: 0;
  min-width: 0;
  border-radius: 0;
}

.pill-toggle.admin-pill-toggle .checkbox-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.pill-toggle.admin-pill-toggle .pill-toggle__pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.02);
  color: #e0e0e0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  line-height: 1.1;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.pill-toggle.admin-pill-toggle .pill-toggle__pill span:last-child {
  flex: 1;
}

.pill-toggle.admin-pill-toggle .pill-toggle__circle {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.pill-toggle.admin-pill-toggle .pill-toggle__circle::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8ddcff, #5ac1ff);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 0 8px rgba(93, 184, 255, 0.35);
}

.pill-toggle.admin-pill-toggle .checkbox-input:focus-visible + .pill-toggle__pill {
  outline: none;
  border-color: rgba(141, 220, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(141, 220, 255, 0.25);
}

.pill-toggle.admin-pill-toggle .checkbox-input:checked + .pill-toggle__pill {
  border-color: rgba(76, 197, 255, 0.85);
  background: rgba(76, 197, 255, 0.14);
  color: #dff4ff;
}

.pill-toggle.admin-pill-toggle .checkbox-input:checked + .pill-toggle__pill .pill-toggle__circle {
  border-color: rgba(141, 220, 255, 0.9);
  box-shadow: inset 0 0 0 3px rgba(76, 197, 255, 0.25);
}

.pill-toggle.admin-pill-toggle .checkbox-input:checked + .pill-toggle__pill .pill-toggle__circle::after {
  opacity: 1;
  transform: scale(1);
}

.pill-toggle.admin-pill-toggle .checkbox-input:disabled + .pill-toggle__pill {
  opacity: 0.55;
  cursor: not-allowed;
}

.pill-toggle.admin-pill-toggle .checkbox-input:disabled + .pill-toggle__pill .pill-toggle__circle {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.pill-toggle.admin-pill-toggle .checkbox-input:disabled + .pill-toggle__pill .pill-toggle__circle::after {
  opacity: 0;
  transform: scale(0.5);
}

.alert {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
}

.panel { display: none; }
.panel.is-active { display: block; }

.card {
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.card.is-collapsed > .card-body {
  display: none;
}

.card-collapse-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  width: 30px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 1;
}

.card-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.10);
}

.card-body {
  padding: 12px;
}

.chart-embed-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.chart-embed {
  display: block;
  width: 100%;
  height: min(68vh, 640px);
  border: 0;
  background: #111;
}

.muted { color: #b0b0b0; }

.is-hidden { display: none !important; }

.mono { font-family: inherit; font-variant-numeric: tabular-nums; }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

.kv-k {
  color: #b0b0b0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.kv-v {
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.10);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #e0e0e0;
  font-weight: 600;
  opacity: 1;
  transition: opacity 200ms ease;
}

.toast-hide { opacity: 0; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.table--sheet {
  min-width: 1200px;
}

.table--sheet thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(20, 20, 20, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.store-cust-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
}

.sheet-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sheet-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255,255,255,0.92);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1;
  white-space: nowrap;
}

.sheet-chip--btn {
  cursor: pointer;
  font: inherit;
}

.sheet-chip--btn:hover {
  background: rgba(255, 255, 255, 0.10);
}

.sheet-chip--green {
  border-color: rgba(38, 166, 154, 0.55);
  background: rgba(38, 166, 154, 0.18);
}

.sheet-chip--red {
  border-color: rgba(239, 83, 80, 0.55);
  background: rgba(239, 83, 80, 0.14);
}

.sheet-chip--grey {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  opacity: 0.9;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
  white-space: nowrap;
}

.table thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #b0b0b0;
}

.th-sort {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.th-sort:hover {
  color: rgba(255,255,255,0.92);
}

.th-sort[aria-sort="ascending"]::after {
  content: "▲";
  font-size: 10px;
  opacity: 0.85;
}

.th-sort[aria-sort="descending"]::after {
  content: "▼";
  font-size: 10px;
  opacity: 0.85;
}

.store-drag-cell {
  width: 34px;
  padding-right: 0;
}

.store-drag-handle {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255,255,255,0.85);
  border-radius: 8px;
  width: 30px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  font-weight: 900;
  line-height: 1;
}

.store-drag-handle:active {
  cursor: grabbing;
}

tr.is-dragging td {
  opacity: 0.65;
}

tr.is-drop-before td {
  border-top: 2px solid rgba(38, 166, 154, 0.85);
}

tr.is-drop-after td {
  border-bottom: 2px solid rgba(38, 166, 154, 0.85);
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

/* Member Lookup (Members tab) */
.member-search-dropdown {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 20, 0.98);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow: auto;
  max-height: 260px;
  padding: 6px;
}

.member-search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #e0e0e0;
  font: inherit;
  cursor: pointer;
}

.member-search-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.member-search-item.is-active {
  background: rgba(255, 255, 255, 0.10);
  outline: 1px solid rgba(255, 255, 255, 0.12);
}

.member-search-item__primary {
  font-weight: 700;
}

.member-search-item__secondary {
  margin-top: 2px;
  color: #b0b0b0;
  font-size: 12px;
}

.member-selected {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.member-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.row-highlight td {
  background: rgba(38, 166, 154, 0.12) !important;
}

.codebox {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: #e0e0e0;
  overflow: auto;
  max-height: 260px;
  white-space: pre-wrap;
  word-break: break-word;
}

.cust-status {
  width: 32px;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.status-dot.is-online {
  background: var(--t2g-accent-green);
}

.status-dot.is-offline {
  background: var(--t2g-accent-red);
  opacity: 0.85;
}

@keyframes t2g-ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.0); }
  40% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.0); }
  70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.0); }
}

.ping-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--t2g-accent-grey);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.0);
}

.ping-dot.is-green {
  background: var(--t2g-accent-green);
  animation: t2g-ping 2200ms ease-out infinite;
}

.ping-dot.is-grey {
  background: var(--t2g-accent-grey);
  opacity: 0.9;
}

.ping-dot.is-red {
  background: var(--t2g-accent-red);
  animation: t2g-ping 1600ms ease-out infinite;
}

.num {
  text-align: right;
}

.cust-actions {
  text-align: right;
}

.cust-menu {
  position: relative;
  display: inline-block;
}

.cust-menu-btn {
  padding: 6px 10px;
  line-height: 1;
}

.cust-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 170px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 20, 0.98);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 6px;
  z-index: 50;

  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.cust-menu.is-open .cust-menu-pop {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Portal menu (fixed overlay; does not affect table layout/scroll) */
.cust-menu-portal {
  position: fixed;
  left: -9999px;
  top: -9999px;
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
}

.cust-menu-portal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cust-menu-portal-inner {
  min-width: 170px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 20, 0.98);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 6px;
  transform: translateY(-6px);
  transition: transform 140ms ease;
}

.cust-menu-portal.is-open .cust-menu-portal-inner {
  transform: translateY(0);
}

.cust-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #e0e0e0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.cust-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.cust-menu-divider {
  height: 1px;
  margin: 6px 2px;
  background: rgba(255, 255, 255, 0.10);
}

.cust-menu-item.is-danger:hover {
  background: rgba(255, 255, 255, 0.10);
}

@media (max-width: 820px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    text-align: center;
  }

  .header-cta {
    justify-content: center;
  }
}
