/**
 * TrustOps DS — shared primitives (.to-*)
 * Load after tokens.css
 */

.to-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: transform var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out),
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    color var(--motion-fast) ease;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.2;
}
.to-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}
.to-btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.to-btn-md { height: 38px; padding: 0 16px; font-size: 13.5px; }
.to-btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.to-btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-hover);
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.2);
}
.to-btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(29, 78, 216, 0.25);
}
.to-btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-xs);
}
.to-btn-secondary:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  color: var(--text-main);
}
.to-btn-destructive {
  background: var(--surface);
  color: var(--error-text);
  border-color: var(--error-border);
}
.to-btn-destructive:hover:not(:disabled) {
  background: var(--error-bg);
}
.to-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.to-btn-ghost:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--text-main);
}

.to-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: var(--space-5);
}
.to-card-elevated {
  box-shadow: var(--shadow-md);
}

.to-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.to-pill-emerald { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.to-pill-amber { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.to-pill-rose { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
.to-pill-blue { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.to-pill-teal { background: var(--dpdpa-bg); border-color: var(--dpdpa-border); color: var(--dpdpa-text); }
.to-pill-violet { background: var(--ai-bg); border-color: var(--ai-border); color: var(--ai-text); }

.to-input,
.to-select,
.to-textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--text-main);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.to-input:focus,
.to-select:focus,
.to-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.to-label {
  display: block;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}
.to-help { font-size: var(--text-small); color: var(--text-muted); margin-top: 0.25rem; }
.to-error { font-size: var(--text-small); color: var(--error-text); margin-top: 0.25rem; }

.to-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: auto;
  max-height: min(70vh, 720px);
}
.to-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body);
}
.to-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--to-slate-100);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 0.85rem;
  text-align: left;
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.to-table tbody td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.to-table tbody tr:hover { background: var(--surface-soft); }

.to-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.to-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-subtle);
  width: min(640px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
}

.to-sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  background-image: var(--sidebar-glow);
}
.to-sidebar a {
  color: inherit;
  text-decoration: none;
}
.to-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.to-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.to-empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--text-muted);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.to-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: var(--text-small);
}

/* Glass auth panel */
.to-glass {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
}
@media (prefers-reduced-motion: reduce) {
  .to-glass {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.94);
  }
}

/* Drawer */
.to-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-standard) var(--ease-out);
}
.to-drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
@media (max-width: 1023px) {
  .to-sidebar-mobile {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(18rem, 86vw);
    z-index: 45;
    transform: translateX(-105%);
    transition: transform var(--motion-standard) var(--ease-emphasized);
  }
  .to-sidebar-mobile.is-open { transform: translateX(0); }
}
