/**
 * Sarvekam Sarvellam — unified design tokens & shared UI primitives.
 * Used by landing page, login, tenant dashboard, and Master Control Room.
 */

:root {
  /* Brand — matches landing page indigo → purple gradient */
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-soft: #eef2ff;
  --color-secondary: #9333ea;
  --color-gradient: linear-gradient(to right, #2563eb, #4f46e5, #9333ea);
  --color-gradient-hover: linear-gradient(to right, #1d4ed8, #4338ca, #7e22ce);

  /* Surfaces */
  --app-bg: #faf8ff;
  --surface: #ffffff;
  --surface-muted: #f8fafc;

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --font-sans: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Borders & shadows */
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --accent-ring: rgba(79, 70, 229, 0.18);
  --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
  --shadow-float: 0 8px 30px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-brand: 0 10px 25px -5px rgba(79, 70, 229, 0.35);

  /* Radii */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  --sidebar-width: 16rem;
}

/* ── Background mesh (landing + dashboard canvas) ─── */
.mesh-bg {
  background-color: #f4f6fb;
  background-image:
    radial-gradient(at 15% 10%, rgba(199, 210, 254, 0.55) 0, transparent 42%),
    radial-gradient(at 85% 5%, rgba(233, 213, 255, 0.45) 0, transparent 40%),
    radial-gradient(at 50% 95%, rgba(191, 219, 254, 0.35) 0, transparent 48%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.92) 0%, rgba(241, 245, 249, 0.75) 100%);
  background-attachment: fixed;
}

.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

/* ── Buttons ──────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--color-gradient);
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  box-shadow: var(--shadow-brand);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-primary:hover {
  background: var(--color-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -6px rgba(79, 70, 229, 0.45);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-secondary:hover {
  border-color: #c7d2fe;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

/* ── Form controls ────────────────────────────────── */
.input-field,
.sa-input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-field:focus,
.sa-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.input-label,
.sa-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ── Cards ────────────────────────────────────────── */
.saas-card,
.shadow-panel {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.shadow-panel:hover {
  box-shadow: var(--shadow-float);
  border-color: rgba(199, 210, 254, 0.55);
}

.glass-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transition: all 0.2s ease;
}

.glass-card:hover {
  box-shadow: var(--shadow-float);
  border-color: rgba(199, 210, 254, 0.5);
}

/* ── Master Control Room layout ───────────────────── */
.sa-shell {
  font-family: var(--font-sans);
  color: var(--text-primary);
}

.sa-topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.sa-stat-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.sa-stat-card--accent {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
}

/* ── App document pages (create invoice / purchase) ── */
.app-shell-header {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.app-form-section {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

section.saas-card.app-form-section,
section.saas-card:not(.overflow-hidden) {
  padding: 1.5rem;
}

.app-document-page .app-sidebar {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid rgba(255, 255, 255, 0.6);
}

.app-document-page #company-switcher-btn {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}

.app-document-page #top-loading-bar {
  background-color: #4f46e5 !important;
}

/* ── Skeleton loaders ─────────────────────────────── */
.skeleton-shimmer {
  background: linear-gradient(90deg, #e2e8f0 0%, #f8fafc 45%, #e2e8f0 90%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.35s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-block {
  border-radius: var(--radius-md);
}

.stats-content-loading {
  opacity: 0.35;
  pointer-events: none;
}

.stats-content-ready {
  opacity: 1;
  transition: opacity 0.28s ease;
}

.invoice-preview-panel {
  max-height: min(88vh, 920px);
}
