:root {
  --app-radius-xl: 0.75rem;
  --app-radius-lg: 0.5rem;
  --app-radius-md: 0.375rem;
  --app-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
  --app-shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --app-ring: 1px solid rgba(148, 163, 184, 0.55); /* slate-400/55 */
  --app-accent: #00d0e7; /* a-cyan */
  --app-radius-3xl: 0.75rem;
  --app-radius-2xl: 0.75rem;
  --app-radius-xl-tw: 0.625rem;
  --app-radius-lg-tw: 0.5rem;
}

/* Background */
html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(1200px circle at 15% 0%, rgba(0, 208, 231, 0.16), transparent 55%),
    radial-gradient(900px circle at 85% -10%, rgba(38, 56, 80, 0.18), transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 70%, #eef2f7 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(800px circle at 30% 0%, rgba(0, 0, 0, 0.55), transparent 70%);
  z-index: 0;
}

@media (prefers-reduced-motion: no-preference) {
  body {
    animation: app-bg-drift 18s ease-in-out infinite;
  }
  @keyframes app-bg-drift {
    0% {
      background-position: 0 0, 0 0, 0 0;
    }
    50% {
      background-position: 12px -10px, -14px 8px, 0 0;
    }
    100% {
      background-position: 0 0, 0 0, 0 0;
    }
  }
}

/* Focus */
:focus-visible {
  outline: 2px solid rgba(0, 208, 231, 0.85);
  outline-offset: 2px;
}

/* Controls: reduce overly-rounded pills to a consistent enterprise radius */
:root {
  --app-radius-control: 0.375rem; /* ~ tailwind rounded-md */
}

.rounded-3xl {
  border-radius: var(--app-radius-3xl) !important;
}
.rounded-2xl {
  border-radius: var(--app-radius-2xl) !important;
}
.rounded-xl {
  border-radius: var(--app-radius-xl-tw) !important;
}
.rounded-lg {
  border-radius: var(--app-radius-lg-tw) !important;
}

button[class*="rounded"]:not(.app-keep-round),
input[class*="rounded"]:not(.app-keep-round),
select[class*="rounded"]:not(.app-keep-round),
textarea[class*="rounded"]:not(.app-keep-round),
a[class*="rounded"]:not(.app-keep-round) {
  border-radius: var(--app-radius-control) !important;
}

/* Opt-out: keep specific controls perfectly round (e.g. avatar icon). */
button.app-keep-round,
input.app-keep-round,
select.app-keep-round,
textarea.app-keep-round,
a.app-keep-round {
  border-radius: 9999px !important;
}

button.rounded-none,
input.rounded-none,
select.rounded-none,
textarea.rounded-none,
a.rounded-none {
  border-radius: 0 !important;
}

/* Gradient border utility */
.app-gradient-border {
  background: linear-gradient(
    90deg,
    rgba(0, 208, 231, 0.55),
    rgba(148, 163, 184, 0.45),
    rgba(38, 56, 80, 0.35)
  );
}

/* Surfaces */
.app-surface {
  border-radius: var(--app-radius-xl);
  box-shadow: var(--app-shadow-sm);
  border: var(--app-ring);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.app-surface-inner {
  position: relative;
  border-radius: calc(var(--app-radius-xl) - 1px);
  overflow: hidden;
  background: #fff;
}

.app-surface-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(0, 208, 231, 0.10), transparent 42%);
}

/* Data grid */
.app-table {
  border-collapse: separate;
  border-spacing: 0;
}

.app-table thead th,
.app-table thead td {
  background: linear-gradient(180deg, rgba(248, 250, 252, 1), rgba(241, 245, 249, 1));
  color: #0f172a; /* slate-900 */
  border-bottom: 1px solid rgba(148, 163, 184, 0.55);
}

.app-table.app-table-dark thead th,
.app-table.app-table-dark thead td {
  background: linear-gradient(180deg, #263850, #1f2d41);
  color: #fff;
  border-bottom: 1px solid rgba(226, 232, 240, 0.22);
}

.app-table tbody td {
  border-bottom: 1px solid rgba(226, 232, 240, 0.85); /* slate-200 */
}

.app-table tbody tr {
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.app-table tbody tr:hover {
  box-shadow: inset 0 0 0 1px rgba(0, 208, 231, 0.40);
}
