.pos-page {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  width: 100%;
  color: var(--text-primary);
}

.pos-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--surface-card), #f8fbff);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
}

.pos-page-eyebrow {
  color: var(--accent-primary);
  font-size: var(--font-size-eyebrow);
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.pos-page-title {
  margin-top: var(--space-2);
  color: var(--text-primary);
  font-size: var(--font-size-title);
  font-weight: 950;
  line-height: 1.1;
}

.pos-page-subtitle {
  margin-top: var(--space-2);
  max-width: 58rem;
  color: var(--text-secondary);
  font-size: var(--font-size-subtitle);
  font-weight: 700;
  line-height: 1.45;
}

.pos-card,
.pos-content-card,
.pos-filter-bar,
.pos-table-shell {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  box-shadow: var(--shadow-xs);
}

.pos-content-card,
.pos-filter-bar {
  padding: var(--space-4);
}

.pos-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: var(--space-3);
}

.pos-metric-card {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-card), #f8fafc);
  padding: var(--space-4);
}

.pos-metric-label,
.pos-table th,
.pos-field label,
.pos-field > span {
  color: var(--text-muted);
  font-size: var(--font-size-meta);
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.pos-metric-value {
  color: var(--text-primary);
  font-size: 1.65rem;
  font-weight: 950;
  line-height: 1;
}

.pos-metric-helper,
.pos-meta {
  color: var(--text-muted);
  font-size: var(--font-size-meta);
  font-weight: 750;
  line-height: 1.35;
}

.pos-button {
  display: inline-flex;
  min-height: var(--control-height);
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.pos-button:hover {
  transform: translateY(-1px);
}

.pos-button-primary {
  background: var(--accent-primary);
  color: white;
}

.pos-button-primary:hover {
  background: var(--accent-primary-strong);
}

.pos-button-secondary {
  border-color: var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-primary);
}

.pos-button-quiet {
  border-color: transparent;
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.pos-button-danger {
  background: var(--status-danger);
  color: white;
}

.pos-button-compact {
  min-height: 2rem;
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  font-size: 0.72rem;
}

.pos-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: max-content;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.22rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.pos-status-badge::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: currentColor;
}

.pos-status-success {
  border-color: #abefc6;
  background: var(--status-success-bg);
  color: var(--status-success);
}

.pos-status-warning {
  border-color: #fedf89;
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.pos-status-danger {
  border-color: #fecdca;
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.pos-status-info {
  border-color: #b2ccff;
  background: var(--status-info-bg);
  color: var(--status-info);
}

.pos-status-neutral {
  border-color: var(--border-subtle);
  background: var(--status-neutral-bg);
  color: var(--status-neutral);
}

.pos-filter-bar {
  display: grid;
  gap: var(--space-3);
}

.pos-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--space-3);
  align-items: end;
}

.pos-field {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.pos-field input,
.pos-field select,
.pos-field textarea,
.pos-input {
  min-height: var(--control-height);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: white;
  color: var(--text-primary);
  padding: 0.5rem 0.72rem;
  font-size: 0.86rem;
  font-weight: 750;
}

.pos-field input:focus,
.pos-field select:focus,
.pos-field textarea:focus,
.pos-input:focus,
.pos-button:focus-visible,
.pos-sidebar-link:focus-visible,
.pos-mobile-link:focus-visible {
  outline: 3px solid rgb(37 99 235 / 0.28);
  outline-offset: 2px;
}

.pos-table-shell {
  overflow: hidden;
}

.pos-table-scroll {
  overflow-x: auto;
}

.pos-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--font-size-body);
}

.pos-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  padding: 0.75rem;
  text-align: left;
}

.pos-table td {
  border-top: 1px solid #eef2f6;
  padding: 0.75rem;
  vertical-align: top;
}

.pos-table tbody tr:hover {
  background: #f8fbff;
}

.pos-table .pos-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pos-empty-state {
  display: grid;
  gap: var(--space-2);
  justify-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: #f8fafc;
  padding: var(--space-6);
  color: var(--text-secondary);
  text-align: center;
}

.pos-empty-state b {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 950;
}

.pos-alert {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
}

.pos-alert > i {
  background: var(--status-info);
}

.pos-alert-body {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 750;
}

.pos-alert-critical > i,
.pos-alert-danger > i {
  background: var(--status-danger);
}

.pos-alert-warning > i {
  background: var(--status-warning);
}

.pos-alert-success > i {
  background: var(--status-success);
}

.pos-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  padding: var(--space-3);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 850;
}

.pos-skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #e5edf5, #f8fafc, #e5edf5);
  background-size: 220% 100%;
  animation: pos-shimmer 1.2s ease-in-out infinite;
}

.pos-client-risk-badge {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.18rem 0.42rem;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
}

.pos-client-risk-good,
.segment-vip,
.segment-good,
.intel-green {
  border-color: rgb(134 239 172) !important;
  background: rgb(220 252 231) !important;
  color: rgb(21 128 61) !important;
}

.pos-client-risk-medium,
.segment-normal,
.segment-standard,
.segment-retarget,
.intel-yellow {
  border-color: rgb(253 230 138) !important;
  background: rgb(254 243 199) !important;
  color: rgb(146 64 14) !important;
}

.pos-client-risk-risky,
.segment-risky,
.segment-winback,
.intel-orange {
  border-color: rgb(254 215 170) !important;
  background: rgb(255 237 213) !important;
  color: rgb(194 65 12) !important;
}

.pos-client-risk-bad,
.segment-bad,
.segment-blacklisted,
.intel-red {
  border-color: rgb(254 202 202) !important;
  background: rgb(254 226 226) !important;
  color: rgb(153 27 27) !important;
}

.pos-client-risk-unknown,
.segment-new {
  border-color: rgb(203 213 225) !important;
  background: rgb(248 250 252) !important;
  color: rgb(71 85 105) !important;
}

@keyframes pos-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@media (max-width: 767px) {
  .pos-page-header,
  .pos-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pos-filter-grid {
    grid-template-columns: 1fr;
  }

  .pos-table-scroll {
    overflow: visible;
  }

  .pos-table,
  .pos-table thead,
  .pos-table tbody,
  .pos-table tr,
  .pos-table th,
  .pos-table td {
    display: block;
  }

  .pos-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .pos-table tr {
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-3);
  }

  .pos-table td {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: var(--space-3);
    border: 0;
    padding: 0.35rem 0;
  }

  .pos-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: var(--font-size-meta);
    font-weight: 950;
    text-transform: uppercase;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pos-button,
  .pos-skeleton {
    animation: none !important;
    transition: none !important;
  }
}
