/* ═══════════════════════════════════════════════════════
   TSE Design System — CSS Core v1.0
   Framework-agnostic: works in React, PHP, or plain HTML
   
   Import: <link rel="stylesheet" href="tse-core.css">
   ═══════════════════════════════════════════════════════ */

/* ─── Tokens (auto-generated, do not edit below) ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Colors — Navy */
  --tse-navy-50: #edf3f7;
  --tse-navy-100: #d2e1ef;
  --tse-navy-200: #a6c6e3;
  --tse-navy-300: #68a3d9;
  --tse-navy-400: #1b72c0;
  --tse-navy-500: #0a3d6b;
  --tse-navy-600: #073158;
  --tse-navy-700: #042746;
  --tse-navy-800: #031c33;
  --tse-navy-900: #011120;

  /* Colors — Teal */
  --tse-teal-50: #effefa;
  --tse-teal-100: #d0fbf1;
  --tse-teal-200: #a4f5e4;
  --tse-teal-300: #6dead3;
  --tse-teal-400: #3dd8be;
  --tse-teal-500: #128f86;
  --tse-teal-600: #0f7a73;
  --tse-teal-700: #0d655f;
  --tse-teal-800: #0a504c;
  --tse-teal-900: #073c39;

  /* Colors — Status */
  --tse-success: #22c55e;
  --tse-warning: #f59e0b;
  --tse-error: #ef4444;
  --tse-info: #3b82f6;

  /* Colors — Neutral (Slate) */
  --tse-neutral-50: #f8fafc;
  --tse-neutral-100: #f1f5f9;
  --tse-neutral-200: #e2e8f0;
  --tse-neutral-300: #cbd5e1;
  --tse-neutral-400: #94a3b8;
  --tse-neutral-500: #64748b;
  --tse-neutral-600: #475569;
  --tse-neutral-700: #334155;
  --tse-neutral-800: #1e293b;
  --tse-neutral-900: #0f172a;

  /* Semantic aliases */
  --tse-color-primary: var(--tse-navy-500);
  --tse-color-primary-dark: var(--tse-navy-700);
  --tse-color-accent: var(--tse-teal-500);
  --tse-color-accent-light: var(--tse-teal-400);
  --tse-color-bg: var(--tse-neutral-100);
  --tse-color-surface: #ffffff;
  --tse-color-border: var(--tse-neutral-200);
  --tse-color-border-light: var(--tse-neutral-100);
  --tse-color-text: var(--tse-neutral-800);
  --tse-color-text-secondary: var(--tse-neutral-600);
  --tse-color-text-muted: var(--tse-neutral-400);

  /* Typography */
  --tse-font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tse-font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  /* Spacing */
  --tse-space-xs: 0.25rem;
  --tse-space-sm: 0.5rem;
  --tse-space-md: 1rem;
  --tse-space-lg: 1.5rem;
  --tse-space-xl: 2rem;
  --tse-space-2xl: 3rem;
  --tse-space-3xl: 4rem;

  /* Radius */
  --tse-radius-xs: 4px;
  --tse-radius-sm: 6px;
  --tse-radius-md: 8px;
  --tse-radius-lg: 12px;
  --tse-radius-xl: 16px;
  --tse-radius-full: 9999px;

  /* Shadows */
  --tse-shadow-xs: 0 1px 2px rgba(10, 61, 107, 0.04);
  --tse-shadow-sm: 0 1px 3px rgba(10, 61, 107, 0.06), 0 1px 2px rgba(10, 61, 107, 0.04);
  --tse-shadow-md: 0 4px 12px rgba(10, 61, 107, 0.07), 0 1px 3px rgba(10, 61, 107, 0.04);
  --tse-shadow-lg: 0 12px 24px rgba(10, 61, 107, 0.08), 0 4px 8px rgba(10, 61, 107, 0.04);
  --tse-shadow-focus: 0 0 0 3px rgba(18, 143, 134, 0.15);

  /* Motion */
  --tse-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --tse-duration-fast: 150ms;
  --tse-duration-normal: 300ms;
  --tse-duration-slow: 500ms;
  --tse-transition: all 0.2s var(--tse-ease);

  /* Layout */
  --tse-nav-height: 64px;
  --tse-max-width: 1200px;
}


/* ═══════════════════════════════════════════════════════
   RESET (minimal, non-destructive)
   ═══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

.tse-base {
  font-family: var(--tse-font-base);
  color: var(--tse-color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════ */
.tse-h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--tse-navy-500);
  margin: 0 0 var(--tse-space-md);
}

.tse-h2 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--tse-navy-500);
  margin: 0 0 var(--tse-space-md);
}

.tse-h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--tse-navy-500);
  margin: 0 0 var(--tse-space-sm);
}

.tse-h4 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--tse-navy-600);
  margin: 0 0 var(--tse-space-sm);
}

.tse-body {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--tse-color-text);
}

.tse-small {
  font-size: 0.875rem;
  color: var(--tse-color-text-secondary);
}

.tse-caption {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tse-color-text-muted);
}

.tse-mono {
  font-family: var(--tse-font-mono);
}


/* ═══════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════ */
.tse-navbar {
  background: var(--tse-navy-700);
  height: var(--tse-nav-height);
  display: flex;
  align-items: center;
  padding: 0 var(--tse-space-lg);
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.tse-navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--tse-max-width);
  margin: 0 auto;
}

.tse-navbar-logo {
  height: 28px;
  width: auto;
}

.tse-navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--tse-space-sm);
  text-decoration: none;
}

.tse-navbar-brand-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
}

.tse-navbar-brand-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.tse-nav-links {
  display: flex;
  align-items: center;
  gap: var(--tse-space-xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

.tse-nav-link {
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--tse-radius-sm);
  transition: var(--tse-transition);
  text-decoration: none;
  position: relative;
}

.tse-nav-link:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.08);
}

.tse-nav-link.active {
  color: #fff;
  background: rgba(18, 143, 134, 0.2);
}

.tse-nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--tse-teal-500);
  border-radius: 1px;
}


/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */
.tse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-family: var(--tse-font-base);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  border: 2px solid transparent;
  border-radius: var(--tse-radius-md);
  cursor: pointer;
  transition: var(--tse-transition);
  text-decoration: none;
  white-space: nowrap;
}

.tse-btn:focus-visible {
  outline: none;
  box-shadow: var(--tse-shadow-focus);
}

/* Primary — Navy */
.tse-btn-primary {
  background: var(--tse-navy-500);
  color: #fff;
  border-color: var(--tse-navy-500);
}
.tse-btn-primary:hover {
  background: var(--tse-navy-600);
  border-color: var(--tse-navy-600);
  transform: translateY(-1px);
  box-shadow: var(--tse-shadow-md);
}

/* Accent — Teal */
.tse-btn-accent {
  background: var(--tse-teal-500);
  color: #fff;
  border-color: var(--tse-teal-500);
}
.tse-btn-accent:hover {
  background: var(--tse-teal-600);
  border-color: var(--tse-teal-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(18, 143, 134, 0.25);
}

/* Outline — Navy border */
.tse-btn-outline {
  background: transparent;
  color: var(--tse-navy-500);
  border-color: var(--tse-navy-500);
}
.tse-btn-outline:hover {
  background: var(--tse-navy-500);
  color: #fff;
}

/* Ghost — minimal */
.tse-btn-ghost {
  background: transparent;
  color: var(--tse-color-text-secondary);
  border-color: transparent;
}
.tse-btn-ghost:hover {
  background: var(--tse-neutral-100);
  color: var(--tse-color-text);
}

/* Danger */
.tse-btn-danger {
  background: var(--tse-error);
  color: #fff;
  border-color: var(--tse-error);
}
.tse-btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  transform: translateY(-1px);
}

/* Disabled state */
.tse-btn:disabled,
.tse-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Sizes */
.tse-btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  border-radius: var(--tse-radius-sm);
}

.tse-btn-lg {
  padding: 0.8rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--tse-radius-lg);
}


/* ═══════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════ */
.tse-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--tse-radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.4;
}

.tse-badge-success { background: #dcfce7; color: #166534; }
.tse-badge-warning { background: #fef3c7; color: #92400e; }
.tse-badge-error   { background: #fee2e2; color: #991b1b; }
.tse-badge-info    { background: #dbeafe; color: #1e40af; }
.tse-badge-navy    { background: var(--tse-navy-50); color: var(--tse-navy-500); }
.tse-badge-teal    { background: var(--tse-teal-50); color: var(--tse-teal-700); }
.tse-badge-neutral { background: var(--tse-neutral-100); color: var(--tse-neutral-600); }

/* Solid variants */
.tse-badge-solid-success { background: var(--tse-success); color: #fff; }
.tse-badge-solid-warning { background: var(--tse-warning); color: #fff; }
.tse-badge-solid-error   { background: var(--tse-error); color: #fff; }
.tse-badge-solid-info    { background: var(--tse-info); color: #fff; }
.tse-badge-solid-navy    { background: var(--tse-navy-500); color: #fff; }
.tse-badge-solid-teal    { background: var(--tse-teal-500); color: #fff; }


/* ═══════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════ */
.tse-card {
  background: var(--tse-color-surface);
  border: 1px solid var(--tse-color-border);
  border-radius: var(--tse-radius-lg);
  padding: var(--tse-space-lg);
  box-shadow: var(--tse-shadow-sm);
  transition: var(--tse-transition);
}

.tse-card-hover:hover {
  box-shadow: var(--tse-shadow-md);
  transform: translateY(-2px);
  border-color: var(--tse-teal-400);
}

.tse-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--tse-space-md);
  padding-bottom: var(--tse-space-sm);
  border-bottom: 1px solid var(--tse-color-border-light);
}

.tse-card-compact {
  padding: var(--tse-space-md);
}


/* ═══════════════════════════════════════════════════════
   INPUTS / FORMS
   ═══════════════════════════════════════════════════════ */
.tse-input,
.tse-select,
.tse-textarea {
  display: block;
  width: 100%;
  font-family: var(--tse-font-base);
  font-size: 0.875rem;
  padding: 0.6rem 0.875rem;
  background: #fff;
  border: 1px solid var(--tse-neutral-300);
  border-radius: var(--tse-radius-md);
  color: var(--tse-color-text);
  transition: var(--tse-transition);
}

.tse-input:focus,
.tse-select:focus,
.tse-textarea:focus {
  outline: none;
  border-color: var(--tse-teal-500);
  box-shadow: var(--tse-shadow-focus);
}

.tse-input::placeholder {
  color: var(--tse-neutral-400);
}

.tse-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--tse-navy-500);
  margin-bottom: var(--tse-space-xs);
}

.tse-input-error {
  border-color: var(--tse-error);
}
.tse-input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.tse-help-text {
  font-size: 0.78rem;
  color: var(--tse-neutral-500);
  margin-top: var(--tse-space-xs);
}


/* ═══════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════ */
.tse-alert {
  padding: 0.85rem 1.15rem;
  border-radius: var(--tse-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 4px solid;
  margin-bottom: var(--tse-space-md);
}

.tse-alert-info    { background: #eff6ff; border-color: var(--tse-info); color: #1e40af; }
.tse-alert-success { background: #f0fdf4; border-color: var(--tse-success); color: #166534; }
.tse-alert-warning { background: #fffbeb; border-color: var(--tse-warning); color: #92400e; }
.tse-alert-error   { background: #fef2f2; border-color: var(--tse-error); color: #991b1b; }


/* ═══════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════ */
.tse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tse-table th {
  background: var(--tse-navy-500);
  color: #fff;
  text-align: left;
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
}

.tse-table th:first-child { border-radius: var(--tse-radius-md) 0 0 0; }
.tse-table th:last-child  { border-radius: 0 var(--tse-radius-md) 0 0; }

.tse-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--tse-color-border);
}

.tse-table tr:nth-child(even) {
  background: var(--tse-neutral-50);
}

.tse-table tr:hover {
  background: var(--tse-navy-50);
}


/* ═══════════════════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════════════════ */
.tse-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tse-teal-500), var(--tse-navy-400));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.tse-avatar-sm { width: 28px; height: 28px; font-size: 0.62rem; }
.tse-avatar-lg { width: 48px; height: 48px; font-size: 0.9rem; }


/* ═══════════════════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════════════════ */
.tse-divider {
  height: 1px;
  background: var(--tse-color-border);
  border: none;
  margin: var(--tse-space-lg) 0;
}


/* ═══════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════ */
/* Text */
.tse-text-navy    { color: var(--tse-navy-500); }
.tse-text-teal    { color: var(--tse-teal-500); }
.tse-text-muted   { color: var(--tse-color-text-muted); }
.tse-text-success { color: var(--tse-success); }
.tse-text-error   { color: var(--tse-error); }
.tse-text-warning { color: var(--tse-warning); }
.tse-text-center  { text-align: center; }
.tse-text-right   { text-align: right; }

/* Background */
.tse-bg-navy    { background: var(--tse-navy-500); color: #fff; }
.tse-bg-teal    { background: var(--tse-teal-500); color: #fff; }
.tse-bg-surface { background: var(--tse-color-surface); }
.tse-bg-muted   { background: var(--tse-neutral-100); }

/* Flexbox */
.tse-flex         { display: flex; }
.tse-flex-col     { display: flex; flex-direction: column; }
.tse-flex-center  { display: flex; align-items: center; justify-content: center; }
.tse-flex-between { display: flex; align-items: center; justify-content: space-between; }
.tse-flex-wrap    { flex-wrap: wrap; }
.tse-items-center { align-items: center; }
.tse-flex-1       { flex: 1; }

/* Gap */
.tse-gap-xs  { gap: var(--tse-space-xs); }
.tse-gap-sm  { gap: var(--tse-space-sm); }
.tse-gap-md  { gap: var(--tse-space-md); }
.tse-gap-lg  { gap: var(--tse-space-lg); }
.tse-gap-xl  { gap: var(--tse-space-xl); }

/* Margin */
.tse-mb-xs { margin-bottom: var(--tse-space-xs); }
.tse-mb-sm { margin-bottom: var(--tse-space-sm); }
.tse-mb-md { margin-bottom: var(--tse-space-md); }
.tse-mb-lg { margin-bottom: var(--tse-space-lg); }
.tse-mb-xl { margin-bottom: var(--tse-space-xl); }
.tse-mt-md { margin-top: var(--tse-space-md); }
.tse-mt-lg { margin-top: var(--tse-space-lg); }

/* Padding */
.tse-p-sm  { padding: var(--tse-space-sm); }
.tse-p-md  { padding: var(--tse-space-md); }
.tse-p-lg  { padding: var(--tse-space-lg); }
.tse-p-xl  { padding: var(--tse-space-xl); }

/* Grid */
.tse-grid {
  display: grid;
  gap: var(--tse-space-md);
}
.tse-grid-2 { grid-template-columns: repeat(2, 1fr); }
.tse-grid-3 { grid-template-columns: repeat(3, 1fr); }
.tse-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .tse-grid-2,
  .tse-grid-3,
  .tse-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Container */
.tse-container {
  width: 100%;
  max-width: var(--tse-max-width);
  margin: 0 auto;
  padding: 0 var(--tse-space-lg);
}

/* Visibility */
.tse-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Truncate */
.tse-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════ */
@keyframes tse-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tse-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tse-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.tse-animate-in {
  animation: tse-fade-in var(--tse-duration-normal) var(--tse-ease) both;
}

.tse-animate-up {
  animation: tse-fade-up var(--tse-duration-slow) var(--tse-ease) both;
}

.tse-animate-scale {
  animation: tse-scale-in var(--tse-duration-normal) var(--tse-ease) both;
}
