:root {
  --clay-bg: #e9f0f6;
  --clay-bg-2: #f4f8fb;
  --clay-surface: #f7fbff;
  --clay-surface-strong: #ffffff;
  --clay-border: rgba(255,255,255,.78);
  --clay-shadow-dark: rgba(122, 143, 164, .24);
  --clay-shadow-light: rgba(255,255,255,.92);
  --clay-inset-dark: rgba(126, 148, 168, .13);
  --clay-red: #df1738;
  --clay-red-dark: #b70e2a;
  --clay-red-soft: #ffe6eb;
  --clay-blue: #2e72d2;
  --clay-indigo: #5c63d8;
  --clay-green: #159875;
  --clay-amber: #c78316;
  --clay-radius: 24px;
  --clay-radius-sm: 16px;
  --clay-elevated: 14px 14px 30px var(--clay-shadow-dark), -12px -12px 28px var(--clay-shadow-light), inset 1px 1px 0 rgba(255,255,255,.95), inset -1px -1px 0 rgba(128,148,166,.08);
  --clay-soft: 8px 8px 18px rgba(122,143,164,.18), -7px -7px 16px rgba(255,255,255,.82), inset 1px 1px 0 rgba(255,255,255,.92);
  --clay-pressed: inset 5px 5px 12px rgba(130,150,170,.15), inset -5px -5px 12px rgba(255,255,255,.88);
}

html { background: var(--clay-bg); }
body.clay-ui {
  min-height: 100vh;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background:
    radial-gradient(circle at 8% 3%, rgba(255,255,255,.95) 0 8%, transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(218,231,245,.82) 0 10%, transparent 30%),
    linear-gradient(145deg, var(--clay-bg-2), var(--clay-bg));
  color: #243447;
}
body.clay-ui::before,
body.clay-ui::after {
  content: '';
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(1px);
  opacity: .8;
}
body.clay-ui::before { width: 280px; height: 280px; top: 12%; left: -120px; background: rgba(255,255,255,.55); }
body.clay-ui::after { width: 340px; height: 340px; bottom: 8%; right: -170px; background: rgba(204,220,237,.52); }

/* Shared navigation */
.clay-topbar {
  background: rgba(240,246,251,.86) !important;
  border: 0 !important;
  box-shadow: 0 10px 25px rgba(104,126,148,.16), inset 0 -1px 0 rgba(255,255,255,.88);
  backdrop-filter: blur(18px) saturate(125%);
}
.clay-topbar-inner {
  background: rgba(247,251,255,.72);
  border: 1px solid rgba(255,255,255,.88);
  box-shadow: 7px 7px 16px rgba(124,145,165,.13), -6px -6px 15px rgba(255,255,255,.88);
  border-radius: 22px;
  margin-top: 8px;
  margin-bottom: 8px;
}
.clay-avatar {
  background: linear-gradient(145deg, #ff4666, #c91431) !important;
  box-shadow: 7px 7px 14px rgba(161,24,51,.24), -5px -5px 13px rgba(255,255,255,.82), inset 2px 2px 4px rgba(255,255,255,.38), inset -2px -3px 5px rgba(111,8,29,.2) !important;
  border: 2px solid rgba(255,255,255,.68);
}
.clay-icon-button {
  background: var(--clay-surface) !important;
  box-shadow: var(--clay-soft) !important;
  border: 1px solid var(--clay-border) !important;
}
.clay-icon-button:active { box-shadow: var(--clay-pressed) !important; transform: translateY(1px); }

.clay-bottom-nav {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
}
.clay-bottom-dock {
  background: rgba(247,251,255,.94);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 26px;
  box-shadow: 12px 12px 28px rgba(101,126,150,.22), -10px -10px 24px rgba(255,255,255,.94), inset 1px 1px 0 rgba(255,255,255,.95);
  overflow: visible;
}
.clay-bottom-dock > a {
  margin: 6px 2px;
  border-radius: 18px;
  transition: .18s ease;
}
.clay-bottom-dock > a:hover,
.clay-bottom-dock > a:focus-visible {
  background: rgba(255,255,255,.76);
  box-shadow: 5px 5px 12px rgba(117,139,159,.13), -4px -4px 10px rgba(255,255,255,.9);
}
.clay-bottom-dock > a:active { box-shadow: var(--clay-pressed); }
.clay-fab {
  background: linear-gradient(145deg, #ff4566, #c91130) !important;
  border-color: #eef4f9 !important;
  box-shadow: 9px 10px 22px rgba(167,21,49,.28), -7px -7px 18px rgba(255,255,255,.95), inset 2px 2px 5px rgba(255,255,255,.35), inset -2px -3px 6px rgba(113,9,30,.24) !important;
}

/* Clay surfaces. Keep tables dense, cards tactile. */
body.clay-ui .clay-panel,
body.clay-ui .bg-white.rounded-3xl,
body.clay-ui .bg-white.rounded-\[2rem\],
body.clay-ui .bg-white.rounded-2xl,
body.clay-ui [class*="bg-white"][class*="rounded-[2rem]"],
body.clay-ui [class*="bg-white"][class*="rounded-3xl"] {
  background: linear-gradient(145deg, rgba(255,255,255,.95), rgba(239,246,252,.92)) !important;
  border-color: rgba(255,255,255,.82) !important;
  box-shadow: var(--clay-elevated) !important;
}
body.clay-ui div[class*="bg-white"][class*="shadow"],
body.clay-ui section[class*="bg-white"][class*="shadow"] {
  background: linear-gradient(145deg, rgba(255,255,255,.95), rgba(239,246,252,.92)) !important;
  border-color: rgba(255,255,255,.82) !important;
  box-shadow: var(--clay-elevated) !important;
}

body.clay-ui .shadow-xl,
body.clay-ui .shadow-lg:not(button):not(a) {
  --tw-shadow: none !important;
  --tw-shadow-colored: none !important;
}
body.clay-ui .border-slate-100,
body.clay-ui .border-gray-100 { border-color: rgba(255,255,255,.72) !important; }

/* Inputs are slightly recessed to distinguish editable zones. */
body.clay-ui input:not([type="checkbox"]):not([type="radio"]),
body.clay-ui select,
body.clay-ui textarea,
body.clay-ui .input-field {
  background: rgba(236,243,249,.82) !important;
  border: 1px solid rgba(255,255,255,.7) !important;
  box-shadow: inset 4px 4px 9px rgba(124,145,163,.13), inset -4px -4px 9px rgba(255,255,255,.88) !important;
  color: #253649 !important;
  border-radius: 16px !important;
}
body.clay-ui input:focus,
body.clay-ui select:focus,
body.clay-ui textarea:focus,
body.clay-ui .input-field:focus {
  outline: none !important;
  border-color: rgba(223,23,56,.32) !important;
  box-shadow: inset 4px 4px 9px rgba(124,145,163,.11), inset -4px -4px 9px rgba(255,255,255,.92), 0 0 0 4px rgba(223,23,56,.08) !important;
}
body.clay-ui input:disabled,
body.clay-ui select:disabled,
body.clay-ui textarea:disabled {
  opacity: .62;
  filter: saturate(.65);
}

/* Primary and secondary actions */
body.clay-ui button,
body.clay-ui a[class*="bg-"] {
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
body.clay-ui button[class*="bg-gradient-to-r"],
body.clay-ui button[class*="bg-red-"],
body.clay-ui button[class*="bg-rose-"],
body.clay-ui a[class*="bg-gradient-to-r"],
body.clay-ui a[class*="bg-red-"],
body.clay-ui a[class*="bg-rose-"] {
  box-shadow: 7px 8px 16px rgba(170,24,51,.23), -4px -4px 11px rgba(255,255,255,.82), inset 2px 2px 4px rgba(255,255,255,.25), inset -2px -2px 4px rgba(110,7,28,.2) !important;
  border: 1px solid rgba(255,255,255,.2) !important;
}
body.clay-ui button[class*="bg-slate-"],
body.clay-ui a[class*="bg-slate-"] {
  box-shadow: 7px 8px 16px rgba(62,80,98,.2), -4px -4px 11px rgba(255,255,255,.74), inset 1px 1px 3px rgba(255,255,255,.2) !important;
}
body.clay-ui button[class*="bg-emerald-"],
body.clay-ui a[class*="bg-emerald-"] {
  box-shadow: 7px 8px 16px rgba(26,129,102,.18), -4px -4px 11px rgba(255,255,255,.76), inset 1px 1px 3px rgba(255,255,255,.25) !important;
}
body.clay-ui button:active,
body.clay-ui a[class*="bg-"]:active { transform: translateY(1px) scale(.985); filter: brightness(.98); }

/* Tabs become pill-like clay controls. */
body.clay-ui .dash-tab-sticky,
body.clay-ui [class*="bg-white/50"][class*="rounded-[1.5rem]"] {
  background: rgba(236,244,250,.88) !important;
  border: 1px solid rgba(255,255,255,.8) !important;
  box-shadow: 8px 8px 17px rgba(121,144,164,.16), -7px -7px 16px rgba(255,255,255,.9), inset 1px 1px 0 rgba(255,255,255,.92) !important;
  backdrop-filter: blur(16px);
}
body.clay-ui .dash-tab-btn:not(.active),
body.clay-ui .input-tab-btn:not(.active) {
  background: rgba(244,249,253,.88) !important;
  border-color: rgba(255,255,255,.86) !important;
  box-shadow: 4px 4px 9px rgba(121,142,161,.12), -3px -3px 8px rgba(255,255,255,.9) !important;
}

/* KPI / statistic blocks */
body.clay-ui .bg-red-50,
body.clay-ui .bg-rose-50,
body.clay-ui .bg-amber-50,
body.clay-ui .bg-indigo-50,
body.clay-ui .bg-emerald-50,
body.clay-ui .bg-slate-50,
body.clay-ui .bg-gray-50 {
  border-color: rgba(255,255,255,.76) !important;
}
body.clay-ui div[class*="bg-red-50"][class*="rounded-2xl"],
body.clay-ui div[class*="bg-rose-50"][class*="rounded-2xl"],
body.clay-ui div[class*="bg-amber-50"][class*="rounded-2xl"],
body.clay-ui div[class*="bg-indigo-50"][class*="rounded-2xl"],
body.clay-ui div[class*="bg-emerald-50"][class*="rounded-2xl"],
body.clay-ui div[class*="bg-slate-50"][class*="rounded-2xl"] {
  box-shadow: 6px 6px 13px rgba(123,143,163,.11), -5px -5px 12px rgba(255,255,255,.8), inset 1px 1px 0 rgba(255,255,255,.75) !important;
}

/* Funnel hero keeps contrast but receives clay depth. */
body.clay-ui .funnel-card,
body.clay-ui .clay-dark-panel {
  background: linear-gradient(145deg, #24364a, #101b2a) !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  box-shadow: 14px 16px 30px rgba(74,91,108,.28), -10px -10px 22px rgba(255,255,255,.68), inset 2px 2px 5px rgba(255,255,255,.08), inset -2px -2px 5px rgba(0,0,0,.18) !important;
}
body.clay-ui div[class*="from-indigo-900"][class*="to-slate-900"] {
  background: linear-gradient(145deg, #6673e8, #35428f) !important;
  box-shadow: 14px 16px 30px rgba(73,84,147,.25), -10px -10px 22px rgba(255,255,255,.75), inset 2px 2px 5px rgba(255,255,255,.18), inset -2px -2px 5px rgba(30,36,82,.18) !important;
  border: 1px solid rgba(255,255,255,.22) !important;
}

/* Tables stay readable, with clay container and raised headers. */
body.clay-ui .table-container,
body.clay-ui table { background: transparent !important; }
body.clay-ui table th {
  background: rgba(229,238,246,.82) !important;
  border-color: rgba(183,201,216,.4) !important;
  color: #63758a !important;
}
body.clay-ui table tbody tr { transition: background .15s ease; }
body.clay-ui table tbody tr:hover td { background: rgba(255,255,255,.58); }
body.clay-ui table td { border-color: rgba(197,211,223,.32) !important; }
body.clay-ui .row-overdue td { background: rgba(255,228,233,.76) !important; }
body.clay-ui .row-stale td { background: rgba(255,245,209,.72) !important; }

/* Status badges */
body.clay-ui span[class*="rounded-full"],
body.clay-ui span[class*="rounded"][class*="px-"] {
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.62), 2px 3px 7px rgba(124,144,162,.08);
}

/* SweetAlert dialogs */
body.clay-ui .swal2-popup {
  background: linear-gradient(145deg, #fbfdff, #edf4fa) !important;
  border: 1px solid rgba(255,255,255,.88) !important;
  border-radius: 28px !important;
  box-shadow: 18px 20px 46px rgba(83,105,126,.28), -12px -12px 28px rgba(255,255,255,.9) !important;
}
body.clay-ui .swal2-input,
body.clay-ui .swal2-textarea,
body.clay-ui .swal2-select { box-shadow: var(--clay-pressed) !important; }
body.clay-ui .swal2-confirm,
body.clay-ui .swal2-cancel { border-radius: 14px !important; box-shadow: 5px 6px 13px rgba(95,115,134,.18) !important; }

/* Login */
.clay-login-shell {
  position: relative;
  overflow: hidden;
}
.clay-login-shell::before,
.clay-login-shell::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}
.clay-login-shell::before { width: 330px; height: 330px; left: -150px; top: -120px; background: rgba(255,255,255,.54); box-shadow: inset -20px -20px 40px rgba(153,176,197,.10); }
.clay-login-shell::after { width: 420px; height: 420px; right: -220px; bottom: -220px; background: rgba(203,220,236,.6); box-shadow: inset 20px 20px 45px rgba(255,255,255,.36); }
.clay-login-card {
  position: relative;
  z-index: 2;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(238,246,252,.96)) !important;
  border: 1px solid rgba(255,255,255,.9) !important;
  border-top: 0 !important;
  border-radius: 32px !important;
  box-shadow: 20px 20px 45px rgba(104,126,146,.24), -16px -16px 36px rgba(255,255,255,.88), inset 2px 2px 4px rgba(255,255,255,.9), inset -2px -2px 4px rgba(127,148,166,.08) !important;
}
.clay-login-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: white;
  background: linear-gradient(145deg, #ff4968, #c91130);
  box-shadow: 9px 10px 20px rgba(167,21,49,.24), -7px -7px 18px rgba(255,255,255,.9), inset 2px 2px 5px rgba(255,255,255,.34), inset -3px -3px 6px rgba(112,8,29,.2);
}

/* Scrollbars */
body.clay-ui ::-webkit-scrollbar { width: 7px; height: 7px; }
body.clay-ui ::-webkit-scrollbar-track { background: transparent; }
body.clay-ui ::-webkit-scrollbar-thumb { background: rgba(128,151,172,.38); border-radius: 99px; }

@media (max-width: 640px) {
  :root { --clay-radius: 20px; --clay-elevated: 9px 10px 21px rgba(118,140,160,.18), -7px -7px 17px rgba(255,255,255,.84), inset 1px 1px 0 rgba(255,255,255,.9); }
  .clay-topbar-inner { border-radius: 18px; margin-left: 8px; margin-right: 8px; }
  .clay-bottom-nav { padding-left: 8px; padding-right: 8px; }
  .clay-bottom-dock { border-radius: 22px; }
  body.clay-ui .bg-white.rounded-3xl,
  body.clay-ui .bg-white.rounded-\[2rem\],
  body.clay-ui [class*="bg-white"][class*="rounded-[2rem]"] { box-shadow: 8px 9px 20px rgba(116,138,158,.17), -6px -6px 16px rgba(255,255,255,.82), inset 1px 1px 0 rgba(255,255,255,.9) !important; }
}
