/* Telemed — UI compartida (módulo integrable) */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;600&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

:root {
  --tm-bg: #0c1220;
  --tm-bg-elevated: #131c2e;
  --tm-surface: #1a2540;
  --tm-border: rgba(148, 180, 200, 0.18);
  --tm-text: #e8f0f4;
  --tm-text-muted: #8fa3b8;
  --tm-accent: #3dd6c6;
  --tm-accent-dim: rgba(61, 214, 198, 0.15);
  --tm-warn: #f4b860;
  --tm-danger: #f07167;
  --tm-radius: 14px;
  --tm-radius-sm: 10px;
  --tm-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --tm-font-display: 'Fraunces', Georgia, serif;
  --tm-font-body: 'DM Sans', system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.tm-app {
  margin: 0;
  min-height: 100vh;
  font-family: var(--tm-font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--tm-text);
  background: var(--tm-bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 10% -20%, rgba(61, 214, 198, 0.08), transparent 50%),
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(100, 120, 200, 0.06), transparent 45%);
}

.tm-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.tm-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--tm-border);
}

.tm-brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.tm-brand h1 {
  margin: 0;
  font-family: var(--tm-font-display);
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tm-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--tm-accent-dim);
  color: var(--tm-accent);
  border: 1px solid rgba(61, 214, 198, 0.35);
}

.tm-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tm-nav a {
  color: var(--tm-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--tm-radius-sm);
  border: 1px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.tm-nav a:hover {
  color: var(--tm-text);
  background: var(--tm-surface);
  border-color: var(--tm-border);
}

.tm-nav a[aria-current='page'] {
  color: var(--tm-accent);
  background: var(--tm-accent-dim);
  border-color: rgba(61, 214, 198, 0.25);
}

.tm-card {
  background: var(--tm-bg-elevated);
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--tm-shadow);
}

.tm-card-title {
  margin: 0 0 0.35rem;
  font-family: var(--tm-font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.tm-card-desc {
  margin: 0 0 1rem;
  color: var(--tm-text-muted);
  font-size: 0.9rem;
}

.tm-video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 720px) {
  .tm-video-grid {
    grid-template-columns: 1fr;
  }
}

.tm-video-wrap {
  position: relative;
  border-radius: var(--tm-radius-sm);
  overflow: hidden;
  background: #060a10;
  aspect-ratio: 4/3;
  border: 1px solid var(--tm-border);
}

.tm-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tm-video-label {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 6px;
  background: rgba(6, 10, 16, 0.75);
  backdrop-filter: blur(8px);
  color: var(--tm-text);
}

.tm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.tm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--tm-font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.15rem;
  border-radius: var(--tm-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s, border-color 0.15s;
}

.tm-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.tm-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tm-btn--primary {
  background: linear-gradient(145deg, #45e4d4, #2eb8aa);
  color: #042a28;
  box-shadow: 0 4px 20px rgba(61, 214, 198, 0.35);
}

.tm-btn--primary:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(61, 214, 198, 0.45);
}

.tm-btn--secondary {
  background: var(--tm-surface);
  color: var(--tm-text);
  border-color: var(--tm-border);
}

.tm-btn--secondary:hover:not(:disabled) {
  border-color: rgba(148, 180, 200, 0.35);
  background: #1e2d4d;
}

.tm-btn--ghost {
  background: transparent;
  color: var(--tm-text-muted);
  border-color: var(--tm-border);
}

.tm-btn--ghost:hover:not(:disabled) {
  color: var(--tm-text);
  background: var(--tm-surface);
}

.tm-btn--danger {
  background: rgba(240, 113, 103, 0.12);
  color: #ff9a93;
  border-color: rgba(240, 113, 103, 0.35);
}

.tm-btn--danger:hover:not(:disabled) {
  background: rgba(240, 113, 103, 0.2);
}

.tm-status {
  flex: 1 1 200px;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: var(--tm-radius-sm);
  font-size: 0.85rem;
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
  color: var(--tm-text-muted);
}

.tm-status[data-state='ok'] {
  border-color: rgba(61, 214, 198, 0.35);
  color: var(--tm-accent);
}

.tm-status[data-state='warn'] {
  border-color: rgba(244, 184, 96, 0.4);
  color: var(--tm-warn);
}

.tm-status[data-state='err'] {
  border-color: rgba(240, 113, 103, 0.4);
  color: #ff9a93;
}

.tm-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--tm-text-muted);
}

.tm-hint code {
  font-size: 0.78em;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
}

/* Dashboard */
.tm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}

.tm-stat-card {
  background: var(--tm-surface);
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius-sm);
  padding: 1rem;
  transition: border-color 0.15s;
}

.tm-stat-card:hover {
  border-color: rgba(61, 214, 198, 0.25);
}

.tm-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tm-text-muted);
  margin-bottom: 0.35rem;
}

.tm-stat-value {
  font-family: var(--tm-font-display);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--tm-text);
  line-height: 1.1;
}

.tm-json {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--tm-radius-sm);
  background: #080c14;
  border: 1px solid var(--tm-border);
  font-size: 0.72rem;
  overflow: auto;
  max-height: 220px;
  color: #a8bdd0;
}

.tm-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

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