: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;
  /* "Info" blue gradient (kept in sync with A_LIGHT_BLUE_COLOR). */
  --app-info-top: #2790c7;
  --app-info-bottom: #1d6c95;
  --app-info-gradient: linear-gradient(180deg, var(--app-info-top), var(--app-info-bottom));
  /* Light header surface — used by .app-table thead and sticky page headers. */
  --app-thead-top: #f8fafc;
  --app-thead-bottom: #f1f5f9;
  --app-thead-gradient: linear-gradient(180deg, var(--app-thead-top), var(--app-thead-bottom));
  /* Solid header for tables with zebra rows — same neutral-cyan hue as
     bg-a-gray (#eaeced, the darker zebra) but a step darker so the header
     reads as distinct from the rows. */
  --app-thead-solid: #dee0e1;
}

/* Status: "info" blue (matches Inputs issue-type info highlight). */
.bg-a-info {
  background: var(--app-info-gradient) !important;
}

/* Alias for A_LIGHT_BLUE_COLOR (used as an action color, e.g. Publish). */
.bg-a-light-blue {
  background: var(--app-info-gradient) !important;
}

.text-a-light-blue {
  color: var(--app-info-top) !important;
}

.border-a-info {
  border-color: var(--app-info-bottom) !important;
}

/* 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;
}

/* Euclid: make checkbox fills consistently blue. */
.euclid-scope input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(148, 163, 184, 0.85); /* slate-400/85 */
  background: #fff;
  display: inline-block;
  vertical-align: middle;
  cursor: pointer;
}

.euclid-scope input[type="checkbox"]:checked {
  background-color: #263850; /* a-blue */
  border-color: #263850;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M16.7 5.6 8.3 14 3.3 9' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.9rem 0.9rem;
}

.euclid-scope input[type="checkbox"]:indeterminate {
  background-color: #263850; /* a-blue */
  border-color: #263850;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M4 10h12' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.9rem 0.9rem;
}

.euclid-scope input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(0, 208, 231, 0.85);
  outline-offset: 2px;
}

.euclid-scope input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Euclid: radio buttons match checkbox style. */
.euclid-scope input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.85);
  background: #fff;
  display: inline-block;
  vertical-align: middle;
  cursor: pointer;
}

.euclid-scope input[type="radio"]:checked {
  background-color: #263850; /* a-blue */
  border-color: #263850;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='4' fill='%23fff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.euclid-scope input[type="radio"]:focus-visible {
  outline: 2px solid rgba(0, 208, 231, 0.85);
  outline-offset: 2px;
}

.euclid-scope input[type="radio"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@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;
}

/* Square-corner override. The shape selectors match the
   `*[class*="rounded"]:not(.app-keep-round)` rule above so this wins on
   source order rather than losing on specificity. */
button[class*="rounded"].rounded-none,
input[class*="rounded"].rounded-none,
select[class*="rounded"].rounded-none,
textarea[class*="rounded"].rounded-none,
a[class*="rounded"].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%);
}

.euclid-square-corners {
  border-radius: 0 !important;
}

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

.app-table thead th,
.app-table thead td {
  background: var(--app-thead-gradient);
  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 1px 0 rgba(0, 208, 231, 0.40);
}

.app-table tbody tr:hover td {
  border-bottom-color: rgba(0, 208, 231, 0.40);
}
