/* ============================================================
   v3.1 — Fluid Workspace
   Material clarity with iOS-like depth, motion and tactility.
   ============================================================ */

:root {
  --ios-bg: #f2f2f7;
  --ios-surface: rgba(255, 255, 255, .82);
  --ios-surface-strong: rgba(255, 255, 255, .94);
  --ios-fill: rgba(118, 118, 128, .08);
  --ios-fill-strong: rgba(118, 118, 128, .13);
  --ios-separator: rgba(60, 60, 67, .12);
  --ios-label: #1d1d1f;
  --ios-secondary-label: rgba(60, 60, 67, .72);
  --ios-tertiary-label: rgba(60, 60, 67, .48);
  --ios-blue: var(--accent);
  --ios-green: #34c759;
  --ios-orange: #ff9f0a;
  --ios-red: #ff3b30;
  --ios-radius-xl: 30px;
  --ios-radius-lg: 24px;
  --ios-radius-md: 18px;
  --ios-radius-sm: 13px;
  --spring: cubic-bezier(.22, 1, .36, 1);
  --snappy: cubic-bezier(.2, .8, .2, 1);
  --shadow-float: 0 24px 60px rgba(29, 29, 31, .08), 0 3px 14px rgba(29, 29, 31, .05);
  --shadow-card: 0 12px 32px rgba(29, 29, 31, .055), 0 1px 2px rgba(29, 29, 31, .035);
  --shadow-card-hover: 0 20px 44px rgba(29, 29, 31, .09), 0 4px 12px rgba(29, 29, 31, .045);
  --sidebar-w: 272px;
  --topbar-h: 78px;
  --radius: var(--ios-radius-lg);
  --radius-sm: var(--ios-radius-sm);
  --bg: var(--ios-bg);
  --card: #fff;
  --line: var(--ios-separator);
  --md-surface-container-low: var(--ios-bg);
  --md-outline-variant: var(--ios-separator);
}

html {
  background: var(--ios-bg);
  scroll-behavior: smooth;
}

body {
  position: relative;
  overflow-x: hidden;
  background: var(--ios-bg);
  color: var(--ios-label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { letter-spacing: inherit; }

:focus-visible {
  outline: 4px solid color-mix(in srgb, var(--md-primary) 18%, transparent);
  outline-offset: 2px;
}

/* Background atmosphere: subtle and static, never decorative noise. */
.ambient-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.ambient-layer::before,
.ambient-layer::after,
.ambient-layer span {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}
.ambient-layer::before {
  width: 48vw;
  height: 48vw;
  min-width: 520px;
  min-height: 520px;
  top: -31vw;
  right: -12vw;
  background: radial-gradient(circle, color-mix(in srgb, var(--grad-b) 11%, transparent) 0, transparent 70%);
}
.ambient-layer::after {
  width: 44vw;
  height: 44vw;
  min-width: 480px;
  min-height: 480px;
  left: 8vw;
  bottom: -34vw;
  background: radial-gradient(circle, color-mix(in srgb, var(--md-primary) 9%, transparent) 0, transparent 70%);
}
.ambient-layer span:first-child {
  width: 220px;
  height: 220px;
  top: 18%;
  left: 36%;
  background: radial-gradient(circle, rgba(255,255,255,.78), rgba(255,255,255,0));
}
.ambient-layer span:last-child { display: none; }

/* Floating application frame */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  padding: 12px 12px 12px 0;
  gap: 12px;
}

.app-sidebar {
  position: fixed;
  inset: 12px auto 12px 12px;
  width: calc(var(--sidebar-w) - 12px);
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--ios-radius-xl);
  background: rgba(246, 246, 249, .76);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255,255,255,.76);
  -webkit-backdrop-filter: saturate(160%) blur(28px);
  backdrop-filter: saturate(160%) blur(28px);
}

.app-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(145deg, rgba(255,255,255,.48), rgba(255,255,255,.08));
  pointer-events: none;
}

.app-main {
  position: relative;
  grid-column: 2;
  min-height: calc(100vh - 24px);
  border-radius: var(--ios-radius-xl);
}

.top-app-bar {
  position: sticky;
  top: 12px;
  z-index: 1025;
  min-height: var(--topbar-h);
  margin: 0 4px;
  padding: 12px clamp(18px, 3vw, 34px);
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 25px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 12px 34px rgba(29,29,31,.045), inset 0 1px 0 rgba(255,255,255,.85);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  transition: min-height .35s var(--spring), box-shadow .35s var(--spring), background-color .35s ease, border-radius .35s var(--spring);
}

.top-app-bar.is-scrolled {
  min-height: 66px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 16px 40px rgba(29,29,31,.08), inset 0 1px 0 rgba(255,255,255,.95);
}

.topbar-copy { display: grid; gap: 3px; }
.topbar-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--ios-secondary-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  text-transform: none;
}
.topbar-context-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ios-green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ios-green) 13%, transparent);
}
.topbar-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.035em;
}
.topbar-actions { gap: 8px; }

.content-shell {
  max-width: 1460px;
  padding: 28px clamp(18px, 3vw, 36px) 52px;
}

.app-footer {
  margin: 0 4px 4px;
  border: 0;
  border-radius: 20px;
  background: rgba(255,255,255,.5);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

/* Brand and navigation */
.app-brand {
  min-height: 60px;
  margin: 1px 2px 15px;
  padding: 8px 9px;
  border-radius: 20px;
  transition: transform .35s var(--spring), background-color .25s ease;
}
.app-brand:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.65);
}
.app-brand .logo, .brand .logo {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--md-primary) 88%, white), color-mix(in srgb, var(--md-primary) 82%, var(--grad-b))) !important;
  box-shadow: 0 9px 20px color-mix(in srgb, var(--md-primary) 22%, transparent), inset 0 1px 0 rgba(255,255,255,.38) !important;
  transition: transform .45s var(--spring), box-shadow .35s ease;
}
.app-brand:hover .logo { transform: rotate(-3deg) scale(1.04); }
.app-brand .brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.025em; }
.app-brand .brand-caption { margin-top: 1px; color: var(--ios-tertiary-label); font-size: 11px; }

.side-nav { gap: 3px; }
.side-nav-label {
  margin: 17px 13px 7px;
  color: var(--ios-tertiary-label);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .08em;
}
.side-nav-link {
  position: relative;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 17px;
  color: var(--ios-secondary-label);
  font-weight: 600;
  transition: transform .35s var(--spring), background-color .25s ease, color .25s ease, box-shadow .35s var(--spring), border-color .25s ease;
}
.side-nav-link i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 18px;
  transition: transform .42s var(--spring), background-color .25s ease;
}
.side-nav-link:hover {
  transform: translateX(3px);
  background: rgba(255,255,255,.58);
  color: var(--ios-label);
}
.side-nav-link:hover i { transform: scale(1.07); }
.side-nav-link.active {
  color: color-mix(in srgb, var(--md-primary) 80%, #101010);
  border-color: rgba(255,255,255,.74);
  background: rgba(255,255,255,.82);
  box-shadow: 0 9px 22px rgba(29,29,31,.055), inset 0 1px 0 rgba(255,255,255,.92);
}
.side-nav-link.active::after {
  content: "";
  position: absolute;
  right: 10px;
  width: 5px;
  height: 18px;
  border-radius: 999px;
  background: var(--md-primary);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--md-primary) 28%, transparent);
}
.side-nav-link.active i {
  color: #fff;
  background: var(--md-primary);
  box-shadow: 0 7px 15px color-mix(in srgb, var(--md-primary) 22%, transparent);
}
.side-nav-link.active .badge { margin-right: 12px; }

.sidebar-user {
  padding: 9px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 21px;
  background: rgba(255,255,255,.64);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  transition: transform .35s var(--spring), box-shadow .35s ease;
}
.sidebar-user:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.avatar,
.user-menu-button {
  background: linear-gradient(145deg, color-mix(in srgb, var(--md-primary) 14%, white), color-mix(in srgb, var(--grad-b) 11%, white)) !important;
  color: color-mix(in srgb, var(--md-primary) 82%, #111) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.user-menu-button {
  width: 42px;
  height: 42px;
  transition: transform .36s var(--spring), box-shadow .3s ease;
}
.user-menu-button:hover { transform: scale(1.06); box-shadow: 0 8px 18px rgba(29,29,31,.08); }
.user-menu-button:active { transform: scale(.94); }

.pill {
  min-height: 25px;
  padding: 3px 9px;
  border: 1px solid rgba(255,255,255,.55);
  font-size: 11px;
  font-weight: 650;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Page hierarchy and entry motion */
h1, h2, h3, h4, h5, h6 { letter-spacing: -.035em; }
h4 { font-size: 21px; font-weight: 720; }
h5 { font-size: 17px; font-weight: 700; }
.page-toolbar,
.page-heading,
.content-shell > .d-flex.justify-content-between.align-items-center.mb-3 {
  margin-bottom: 18px !important;
}
.page-toolbar h4,
.page-heading h4 { display: flex; align-items: center; gap: 9px; }
.page-toolbar h4 > i,
.page-heading h4 > i {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  background: color-mix(in srgb, var(--md-primary) 10%, white);
  color: var(--md-primary);
  font-size: 16px;
}

.content-shell > * {
  animation: contentRise .72s var(--spring) both;
}
.content-shell > *:nth-child(2) { animation-delay: .035s; }
.content-shell > *:nth-child(3) { animation-delay: .07s; }
.content-shell > *:nth-child(4) { animation-delay: .105s; }
.content-shell > *:nth-child(5) { animation-delay: .14s; }
.content-shell > *:nth-child(n+6) { animation-delay: .17s; }
@keyframes contentRise {
  from { opacity: 0; transform: translateY(10px) scale(.995); }
  to { opacity: 1; transform: none; }
}

/* Dashboard welcome surface */
.dashboard-welcome {
  position: relative;
  isolation: isolate;
  min-height: 178px;
  margin-bottom: 18px;
  padding: clamp(24px, 3.5vw, 38px);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 32px;
  background:
    radial-gradient(circle at 84% 14%, color-mix(in srgb, var(--grad-b) 15%, transparent), transparent 34%),
    radial-gradient(circle at 65% 105%, color-mix(in srgb, var(--md-primary) 13%, transparent), transparent 36%),
    rgba(255,255,255,.82);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,.94);
  -webkit-backdrop-filter: saturate(150%) blur(22px);
  backdrop-filter: saturate(150%) blur(22px);
}
.dashboard-welcome::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 190px;
  height: 190px;
  right: 8%;
  top: -95px;
  border: 30px solid rgba(255,255,255,.3);
  border-radius: 50%;
  transform: rotate(18deg);
}
.dashboard-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: var(--md-primary);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.dashboard-welcome h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 760;
  line-height: 1.12;
  letter-spacing: -.055em;
}
.dashboard-welcome p { margin: 10px 0 0; color: var(--ios-secondary-label); font-size: 14px; }
.dashboard-welcome-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }

/* Surfaces: layered instead of universally boxed */
.card, .panel {
  position: relative;
  overflow: clip;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: var(--ios-radius-lg);
  background: var(--ios-surface);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,.9);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  transition: transform .55s var(--spring), box-shadow .45s var(--spring), border-color .3s ease, background-color .3s ease;
}
.card.interactive-surface::after,
.plugin-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  border-radius: inherit;
  background: radial-gradient(280px circle at var(--pointer-x, 50%) var(--pointer-y, 50%), color-mix(in srgb, var(--md-primary) 8%, white), transparent 68%);
  pointer-events: none;
  transition: opacity .35s ease;
}
.card.interactive-surface:hover::after,
.plugin-card:hover::after { opacity: 1; }
.card > *, .plugin-card > * { position: relative; z-index: 1; }
.card .card-body { padding: 22px; }
.card-header, .card-footer {
  border-color: var(--ios-separator);
  background: rgba(250,250,252,.66);
}
.card.interactive-surface:hover,
.plugin-card:hover {
  transform: translateY(-3px) scale(1.003);
  border-color: rgba(255,255,255,.95);
  box-shadow: var(--shadow-card-hover), inset 0 1px 0 rgba(255,255,255,.96);
}
.card.interactive-surface:active, .plugin-card:active { transform: translateY(-1px) scale(.995); transition-duration: .12s; }
.data-card { overflow: hidden; }
.data-card:hover { transform: none; box-shadow: var(--shadow-card); }

.metric-grid { --bs-gutter-x: 14px; --bs-gutter-y: 14px; }
.metric-card { min-height: 126px; }
.metric-card .card-body { min-height: 126px; padding: 20px; }
.metric-card::before {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -38px;
  bottom: -62px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--metric-color, var(--md-primary)) 9%, transparent);
}
.metric-grid > :nth-child(1) { --metric-color: #0a84ff; }
.metric-grid > :nth-child(2) { --metric-color: #af52de; }
.metric-grid > :nth-child(3) { --metric-color: #ff9f0a; }
.metric-grid > :nth-child(4) { --metric-color: #34c759; }
.metric-icon {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border-radius: 16px;
  color: var(--metric-color, var(--md-primary));
  background: color-mix(in srgb, var(--metric-color, var(--md-primary)) 12%, white);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  transition: transform .48s var(--spring), box-shadow .35s ease;
}
.metric-card:hover .metric-icon { transform: translateY(-3px) rotate(-3deg) scale(1.06); box-shadow: 0 10px 22px color-mix(in srgb, var(--metric-color, var(--md-primary)) 14%, transparent); }
.stat-num { font-size: 30px; font-weight: 760; letter-spacing: -.05em; }
.metric-label { color: var(--ios-secondary-label); font-weight: 560; }

.plugin-card::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0 18px auto;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--md-primary), color-mix(in srgb, var(--grad-b) 62%, var(--md-primary)));
  opacity: .78;
}
.plugin-card .body { padding: 23px; }
.server-card .status-dot { margin-right: 3px; }
.status-on {
  background: var(--ios-green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ios-green) 13%, transparent), 0 0 14px color-mix(in srgb, var(--ios-green) 26%, transparent);
}

/* Buttons: subtle lift and press compression */
.btn {
  min-height: var(--btn-height);
  border-radius: 13px;
  font-weight: 650;
  letter-spacing: -.012em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .42s var(--spring), background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .42s var(--spring), filter .2s ease;
}
.btn:hover { transform: translateY(-1.5px); }
.btn:active, .btn.is-pressing { transform: translateY(0) scale(.965); filter: none; transition-duration: .12s; }
.btn-primary {
  border-color: transparent;
  background: var(--md-primary);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--md-primary) 20%, transparent), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  border-color: transparent;
  background: color-mix(in srgb, var(--md-primary) 91%, #000);
  box-shadow: 0 12px 26px color-mix(in srgb, var(--md-primary) 24%, transparent), inset 0 1px 0 rgba(255,255,255,.24);
}
.btn-soft, .btn-outline-primary {
  border-color: rgba(255,255,255,.7);
  background: color-mix(in srgb, var(--md-primary) 10%, rgba(255,255,255,.86));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-success {
  border-color: rgba(60,60,67,.12);
  background: rgba(255,255,255,.58);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78);
}
.btn-icon { border-radius: 50%; }
.btn-group {
  padding: 4px;
  border: 1px solid rgba(255,255,255,.64);
  border-radius: 15px;
  background: var(--ios-fill);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.68);
}

/* Inputs: filled, soft, and focused like native controls */
.form-label { color: var(--ios-secondary-label); font-size: 12px; font-weight: 650; }
.form-control, .form-select, .input-group-text {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 13px;
  background-color: var(--ios-fill);
  color: var(--ios-label);
  box-shadow: inset 0 1px 2px rgba(29,29,31,.025);
  transition: background-color .25s ease, border-color .25s ease, box-shadow .35s var(--spring), transform .35s var(--spring);
}
.form-control:hover, .form-select:hover { border-color: rgba(60,60,67,.09); background-color: rgba(118,118,128,.105); }
.form-control:focus, .form-select:focus {
  border-color: color-mix(in srgb, var(--md-primary) 42%, transparent);
  background-color: rgba(255,255,255,.94);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-primary) 13%, transparent), 0 8px 20px rgba(29,29,31,.045);
  transform: translateY(-1px);
}
.form-control::placeholder { color: var(--ios-tertiary-label); }
.form-check-input { border-width: 1px; box-shadow: inset 0 1px 2px rgba(29,29,31,.04); }
.form-check-input:checked { box-shadow: 0 4px 10px color-mix(in srgb, var(--md-primary) 18%, transparent); }
.CodeMirror { border: 1px solid rgba(60,60,67,.1) !important; border-radius: 17px !important; box-shadow: inset 0 1px 2px rgba(29,29,31,.025); }
.CodeMirror-focused { border-color: color-mix(in srgb, var(--md-primary) 42%, transparent) !important; box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-primary) 13%, transparent) !important; }

form.row.g-2.mb-3,
form.row.g-3.mb-4 {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 20px;
  background: rgba(255,255,255,.56);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

/* Tables and structured lists */
.table-responsive { scrollbar-width: thin; scrollbar-color: rgba(60,60,67,.2) transparent; }
.table { --bs-table-hover-bg: rgba(118,118,128,.055); }
.table > :not(caption) > * > * { padding: 14px 16px; border-bottom-color: rgba(60,60,67,.095); }
.table > thead,
.table-light { --bs-table-bg: rgba(118,118,128,.045); --bs-table-color: var(--ios-secondary-label); }
.table > thead th { font-size: 10px; font-weight: 720; letter-spacing: .065em; }
.table tbody tr { transition: background-color .22s ease, transform .35s var(--spring); }
.table-hover > tbody > tr:hover > * { background: rgba(118,118,128,.052); }
.list-group-item { border-color: rgba(60,60,67,.1); }
.kv-item {
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 17px;
  background: rgba(255,255,255,.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.78);
  transition: transform .4s var(--spring), box-shadow .35s ease;
}
.kv-item:hover { transform: translateX(3px); box-shadow: 0 9px 24px rgba(29,29,31,.045); }

/* Feedback, chips and status */
.alert {
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.62);
}
.site-announce {
  margin: 12px clamp(18px, 3vw, 36px) 0;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 16px;
  background: color-mix(in srgb, var(--md-primary) 9%, rgba(255,255,255,.72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.badge, .chip, .filter-pill { font-weight: 650; }
.chip, .filter-pill {
  border-color: rgba(60,60,67,.1);
  border-radius: 11px;
  background: rgba(255,255,255,.64);
  transition: transform .35s var(--spring), background-color .2s ease;
}
.chip:hover, .filter-pill:hover { transform: translateY(-1px); background: rgba(255,255,255,.9); }

/* Native-feeling overlays */
.modal-backdrop.show {
  opacity: .24;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}
.modal.fade .modal-dialog { transform: translateY(18px) scale(.96); transition: transform .48s var(--spring); }
.modal.show .modal-dialog { transform: none; }
.modal-content {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 30px;
  background: rgba(252,252,253,.94);
  box-shadow: 0 30px 90px rgba(29,29,31,.18), inset 0 1px 0 rgba(255,255,255,.96);
  -webkit-backdrop-filter: saturate(170%) blur(30px);
  backdrop-filter: saturate(170%) blur(30px);
}
.modal-header, .modal-footer { border-color: rgba(60,60,67,.1); }
.dropdown-menu {
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 18px;
  background: rgba(250,250,252,.92);
  box-shadow: 0 22px 60px rgba(29,29,31,.14), inset 0 1px 0 rgba(255,255,255,.9);
  -webkit-backdrop-filter: saturate(170%) blur(26px);
  backdrop-filter: saturate(170%) blur(26px);
  animation: menuIn .28s var(--spring);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-5px) scale(.97); } to { opacity: 1; transform: none; } }
.dropdown-item { border-radius: 12px; transition: transform .3s var(--spring), background-color .2s ease; }
.dropdown-item:hover { transform: translateX(2px); }
.offcanvas {
  background: rgba(248,248,250,.94);
  -webkit-backdrop-filter: saturate(170%) blur(28px);
  backdrop-filter: saturate(170%) blur(28px);
}
.sheet { border-radius: 32px 32px 0 0; box-shadow: 0 -20px 55px rgba(29,29,31,.13); }
.sheet-item { border-radius: 14px; margin: 0 8px; transition: transform .32s var(--spring), background-color .2s ease; }
.sheet-item:hover { transform: translateX(3px); background: rgba(118,118,128,.075); }
.page-link { transition: transform .35s var(--spring), background-color .2s ease, box-shadow .3s ease; }
.page-link:hover { transform: translateY(-1px); }
.active > .page-link { box-shadow: 0 7px 16px color-mix(in srgb, var(--md-primary) 19%, transparent); }

/* Auth: product-specific visual, not a generic split form */
.auth-page {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 13% 11%, color-mix(in srgb, var(--md-primary) 12%, transparent), transparent 31%),
    radial-gradient(circle at 88% 88%, color-mix(in srgb, var(--grad-b) 10%, transparent), transparent 32%),
    var(--ios-bg);
}
.auth-page::before,
.auth-page::after {
  content: "";
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.52);
}
.auth-page::before { width: 280px; height: 280px; left: -120px; bottom: -110px; }
.auth-page::after { width: 190px; height: 190px; top: -74px; right: -48px; }
.auth-layout {
  width: min(1040px, 100%);
  min-height: 630px;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, .92fr);
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 36px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 38px 100px rgba(29,29,31,.13), inset 0 1px 0 rgba(255,255,255,.98);
  -webkit-backdrop-filter: saturate(160%) blur(28px);
  backdrop-filter: saturate(160%) blur(28px);
  animation: authEnter .8s var(--spring) both;
}
@keyframes authEnter { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.auth-aside {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 42px 46px;
  background:
    radial-gradient(circle at 95% 9%, rgba(255,255,255,.34), transparent 26%),
    linear-gradient(145deg, color-mix(in srgb, var(--md-primary) 14%, white), color-mix(in srgb, var(--grad-b) 12%, white));
}
.auth-aside::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 390px;
  height: 390px;
  right: -230px;
  bottom: -210px;
  border: 58px solid rgba(255,255,255,.28);
  border-radius: 50%;
}
.auth-aside .brand { letter-spacing: -.025em; }
.auth-kicker {
  display: inline-block;
  margin-bottom: 12px;
  color: color-mix(in srgb, var(--md-primary) 76%, #141414);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .13em;
}
.auth-hero h1 {
  max-width: 530px;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 780;
  letter-spacing: -.062em;
}
.auth-hero p { max-width: 490px; color: var(--ios-secondary-label); font-size: 15px; }
.auth-visual {
  position: relative;
  min-height: 185px;
  margin: 22px 0 14px;
  perspective: 800px;
}
.auth-mini-card {
  position: absolute;
  border: 1px solid rgba(255,255,255,.77);
  background: rgba(255,255,255,.72);
  box-shadow: 0 24px 54px rgba(29,29,31,.12), inset 0 1px 0 rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.auth-mini-primary {
  width: min(330px, 78%);
  min-height: 150px;
  left: 1%;
  top: 4px;
  padding: 19px;
  border-radius: 25px;
  transform: rotate(-1.5deg);
}
.auth-mini-primary strong,
.auth-mini-primary small { display: block; }
.auth-mini-primary strong { margin-top: 14px; font-size: 17px; letter-spacing: -.025em; }
.auth-mini-primary small,
.auth-mini-float small { margin-top: 3px; color: var(--ios-secondary-label); }
.auth-mini-top { display: flex; align-items: center; justify-content: space-between; }
.auth-mini-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: color-mix(in srgb, var(--md-primary) 13%, white);
  color: var(--md-primary);
  font-size: 17px;
}
.auth-mini-icon.warm { background: #fff4df; color: #d87900; }
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(52,199,89,.11);
  color: #237a39;
  font-size: 10px;
  font-weight: 720;
}
.live-chip i { width: 6px; height: 6px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 3px rgba(52,199,89,.11); }
.live-chip.ready { background: color-mix(in srgb, var(--md-primary) 10%, white); color: var(--md-primary); }
.live-chip.ready i { background: var(--md-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-primary) 11%, transparent); }
.auth-mini-wave { height: 25px; margin-top: 15px; display: flex; align-items: flex-end; gap: 5px; }
.auth-mini-wave span { width: 14%; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--md-primary) 20%, white); }
.auth-mini-wave span:nth-child(1) { height: 35%; }
.auth-mini-wave span:nth-child(2) { height: 58%; }
.auth-mini-wave span:nth-child(3) { height: 44%; }
.auth-mini-wave span:nth-child(4) { height: 82%; }
.auth-mini-wave span:nth-child(5) { height: 66%; }
.auth-mini-wave span:nth-child(6) { height: 94%; background: var(--md-primary); }
.auth-progress { height: 8px; margin-top: 22px; overflow: hidden; border-radius: 999px; background: rgba(118,118,128,.09); }
.auth-progress span { display: block; width: 68%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--md-primary), color-mix(in srgb, var(--grad-b) 55%, var(--md-primary))); }
.auth-mini-float {
  width: min(290px, 72%);
  min-height: 72px;
  right: 0;
  bottom: 0;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 21px;
  transform: rotate(2deg);
}
.auth-mini-float > div { min-width: 0; flex: 1; }
.auth-mini-float strong, .auth-mini-float small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-mini-check { color: #34c759; font-size: 19px; }
.auth-visual-register .auth-mini-check { color: var(--md-primary); }
.auth-point { color: var(--ios-secondary-label); font-size: 12px; }
.auth-point i { background: rgba(255,255,255,.52); color: var(--md-primary); }
.auth-panel { padding: 54px 52px; }
.auth-panel h2 { font-size: 30px; font-weight: 760; letter-spacing: -.045em; }
.auth-panel .auth-subtitle { color: var(--ios-secondary-label); }
.auth-panel .btn { width: 100%; border-radius: 14px; }

/* Settings and dense pages get calmer grouping. */
.page-settings .content-shell > form > .card,
.page-settings .content-shell > .card { margin-bottom: 14px !important; }
.page-settings .card h6 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
}
.page-settings .card h6 > i {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: color-mix(in srgb, var(--md-primary) 10%, white);
  color: var(--md-primary);
}

/* Mobile: floating island navigation and safe-area-aware sheets */
@media (max-width: 1100px) {
  :root { --sidebar-w: 238px; }
  .app-sidebar { width: calc(var(--sidebar-w) - 12px); }
}

@media (max-width: 820px) {
  :root { --topbar-h: 62px; }
  body { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .app-shell { display: block; padding: 0; }
  .app-main { min-height: 100vh; border-radius: 0; }
  .top-app-bar {
    top: 8px;
    min-height: 62px;
    margin: 0 9px;
    padding: 8px 10px 8px 12px;
    border-radius: 21px;
  }
  .top-app-bar.is-scrolled { min-height: 56px; border-radius: 18px; }
  .mobile-menu-button {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border: 1px solid rgba(255,255,255,.65);
    background: rgba(255,255,255,.54);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.76);
    transition: transform .35s var(--spring), background-color .2s ease;
  }
  .mobile-menu-button:active { transform: scale(.92); }
  .topbar-title { font-size: 18px; }
  .content-shell { padding: 22px 13px 34px; }
  .dashboard-welcome { min-height: 210px; padding: 25px 21px; align-items: flex-start; flex-direction: column; justify-content: space-between; border-radius: 28px; }
  .dashboard-welcome h2 { font-size: 28px; }
  .dashboard-welcome-actions { width: 100%; justify-content: stretch; }
  .dashboard-welcome-actions .btn { flex: 1; }
  .mobile-tabbar {
    inset: auto 10px calc(9px + env(safe-area-inset-bottom)) 10px;
    padding: 5px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.78);
    border-radius: 24px;
    background: rgba(248,248,250,.82);
    box-shadow: 0 18px 46px rgba(29,29,31,.16), inset 0 1px 0 rgba(255,255,255,.93);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    backdrop-filter: saturate(180%) blur(28px);
  }
  .mobile-tabbar a, .mobile-tabbar button {
    min-height: 58px;
    border-radius: 18px;
    color: var(--ios-tertiary-label);
    transition: transform .38s var(--spring), color .2s ease, background-color .25s ease;
  }
  .mobile-tabbar a:active, .mobile-tabbar button:active { transform: scale(.9); }
  .mobile-tabbar i { min-width: 38px; padding: 3px 0; font-size: 20px; transition: transform .42s var(--spring), background-color .25s ease; }
  .mobile-tabbar .active {
    color: var(--md-primary);
    background: color-mix(in srgb, var(--md-primary) 8%, rgba(255,255,255,.7));
  }
  .mobile-tabbar .active i { background: transparent; color: var(--md-primary); transform: translateY(-1px) scale(1.08); }
  .mobile-tabbar .active::before {
    content: "";
    position: absolute;
    top: 3px;
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: var(--md-primary);
  }
  .card .card-body { padding: 19px; }
  .card.interactive-surface:hover,
  .plugin-card:hover { transform: none; }
  .metric-card .card-body { min-height: 116px; padding: 17px; flex-direction: column; align-items: flex-start; gap: 11px; }
  .metric-icon { width: 40px; height: 40px; flex-basis: 40px; border-radius: 13px; }
  .stat-num { font-size: 26px; }
  .auth-layout { min-height: 100vh; border-radius: 0; animation: none; }
  .auth-aside { min-height: 340px; padding: 26px 23px; }
  .auth-hero h1 { font-size: 34px; }
  .auth-visual { min-height: 148px; margin: 14px 0 4px; }
  .auth-mini-primary { min-height: 126px; padding: 15px; }
  .auth-mini-primary strong { margin-top: 9px; }
  .auth-mini-wave { margin-top: 10px; }
  .auth-mini-float { min-height: 64px; }
  .auth-panel { padding: 34px 24px 46px; }
  .site-announce { margin: 10px 12px 0; }
}

@media (max-width: 520px) {
  .dashboard-welcome-actions { flex-direction: column; }
  .dashboard-welcome-actions .btn { width: 100%; }
  .metric-grid > [class*="col-"] { width: 50%; }
  .auth-visual { min-height: 140px; }
  .auth-mini-primary { width: 82%; }
  .auth-mini-float { width: 76%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .content-shell > * { animation: none; }
  .auth-layout, .dropdown-menu { animation: none; }
}

/* Optional administrator-provided background image lives inside the ambient layer. */
:root { --app-bg-image: none; --app-bg-opacity: 0; }
.ambient-layer span:last-child {
  display: block;
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  filter: none;
  opacity: var(--app-bg-opacity);
  background-image: linear-gradient(rgba(242,242,247,.86), rgba(242,242,247,.86)), var(--app-bg-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* Standalone installation and legal pages share the same floating language. */
.install-page,
.legal-page {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 8%, color-mix(in srgb, var(--md-primary) 10%, transparent), transparent 28%),
    radial-gradient(circle at 91% 87%, color-mix(in srgb, var(--grad-b) 8%, transparent), transparent 30%),
    var(--ios-bg);
}
.install-shell { width: min(900px, 100%); }
.install-header {
  margin-bottom: 18px;
  padding: 19px 21px;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 24px;
  background: rgba(255,255,255,.7);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,.92);
  -webkit-backdrop-filter: saturate(150%) blur(20px);
  backdrop-filter: saturate(150%) blur(20px);
}
.install-header .logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--md-primary) 88%, white), color-mix(in srgb, var(--md-primary) 82%, var(--grad-b)));
  box-shadow: 0 10px 23px color-mix(in srgb, var(--md-primary) 21%, transparent), inset 0 1px 0 rgba(255,255,255,.34);
}
.install-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom-color: rgba(60,60,67,.1);
  font-size: 16px;
  letter-spacing: -.025em;
}
.install-section-title::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--md-primary);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--md-primary) 10%, transparent);
}
.legal-shell { width: min(850px, 100%); }
.legal-card { border-radius: 32px; }
.legal-card header { padding-bottom: 22px; border-bottom: 1px solid rgba(60,60,67,.1); }
.legal-card h5 { display: flex; align-items: center; gap: 9px; }
.legal-card h5::before { content: ""; width: 5px; height: 18px; border-radius: 999px; background: var(--md-primary); }

@media (max-width: 820px) {
  body.auth-page,
  body.install-page,
  body.legal-page { padding-bottom: 0; }
  .install-page, .legal-page { padding: 18px 12px 30px; }
  .install-header { padding: 16px; border-radius: 21px; }
  .legal-card { border-radius: 26px; }
}
.topbar-context-dot {
  background: var(--md-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-primary) 11%, transparent);
}
.app-sidebar > .side-nav {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(60,60,67,.16) transparent;
}
.section-count {
  min-height: 28px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  color: var(--ios-secondary-label);
  font-size: 12px;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.auth-kicker { text-transform: none; letter-spacing: .08em; }

/* Installed plugin finder */
.plugin-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.plugin-section-heading,
.plugin-section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.plugin-section-actions { justify-content: flex-end; }
.installed-plugin-search {
  width: min(310px, 34vw);
  min-width: 230px;
  height: 40px;
  padding: 0 8px 0 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(60,60,67,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.58);
  color: var(--ios-secondary-label);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86), 0 4px 14px rgba(29,29,31,.025);
  -webkit-backdrop-filter: saturate(145%) blur(14px);
  backdrop-filter: saturate(145%) blur(14px);
  transition: width .48s var(--spring), border-color .25s ease, background-color .25s ease, box-shadow .4s var(--spring), transform .4s var(--spring);
}
.installed-plugin-search:hover {
  border-color: rgba(60,60,67,.16);
  background: rgba(255,255,255,.72);
}
.installed-plugin-search:focus-within {
  width: min(360px, 39vw);
  border-color: color-mix(in srgb, var(--md-primary) 32%, rgba(60,60,67,.10));
  background: rgba(255,255,255,.94);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-primary) 10%, transparent), 0 12px 28px rgba(29,29,31,.07), inset 0 1px 0 #fff;
  transform: translateY(-1px);
}
.installed-plugin-search > i {
  flex: 0 0 auto;
  font-size: 14px;
  transition: color .22s ease, transform .4s var(--spring);
}
.installed-plugin-search:focus-within > i {
  color: var(--md-primary);
  transform: scale(1.08);
}
.installed-plugin-search input {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--md-on-surface);
  font: inherit;
  font-size: 13px;
  font-weight: 540;
}
.installed-plugin-search input::placeholder { color: var(--ios-tertiary-label); }
.installed-plugin-search input::-webkit-search-decoration,
.installed-plugin-search input::-webkit-search-cancel-button,
.installed-plugin-search input::-webkit-search-results-button,
.installed-plugin-search input::-webkit-search-results-decoration { -webkit-appearance: none; }
.installed-plugin-search-clear {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(60,60,67,.10);
  color: var(--ios-secondary-label);
  font-size: 10px;
  transition: transform .32s var(--spring), background-color .2s ease, color .2s ease;
}
.installed-plugin-search-clear:hover { background: rgba(60,60,67,.16); color: var(--md-on-surface); transform: scale(1.06); }
.installed-plugin-search-clear:active { transform: scale(.88); }
.installed-plugin-search-clear[hidden] { display: none !important; }
.installed-plugin-card[hidden],
.plugin-search-empty[hidden] { display: none !important; }
.installed-plugin-card.search-reveal { animation: pluginSearchReveal .42s var(--spring) both; }
@keyframes pluginSearchReveal {
  from { opacity: 0; transform: translateY(7px) scale(.992); }
  to { opacity: 1; transform: none; }
}
.plugin-search-empty {
  min-height: 94px;
  margin-bottom: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px dashed rgba(60,60,67,.16);
  border-radius: 20px;
  background: rgba(255,255,255,.42);
  color: var(--md-on-surface);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: pluginSearchReveal .42s var(--spring) both;
}
.plugin-search-empty-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--md-primary) 10%, white);
  color: var(--md-primary);
  font-size: 17px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

@media (max-width: 820px) {
  .plugin-section-bar { align-items: stretch; flex-direction: column; gap: 11px; }
  .plugin-section-heading { justify-content: space-between; }
  .plugin-section-actions { width: 100%; justify-content: stretch; }
  .installed-plugin-search { width: auto; min-width: 0; flex: 1 1 auto; }
  .installed-plugin-search:focus-within { width: auto; }
  .plugin-section-actions > .btn { flex: 0 0 auto; }
}

@media (max-width: 520px) {
  .plugin-section-actions { align-items: stretch; flex-direction: column; }
  .installed-plugin-search { width: 100%; min-height: 44px; }
  .plugin-section-actions > .btn { width: 100%; }
  .plugin-search-empty { align-items: flex-start; flex-wrap: wrap; }
  .plugin-search-empty .btn { width: 100%; margin-left: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  .installed-plugin-card.search-reveal,
  .plugin-search-empty { animation: none; }
  .installed-plugin-search { transition: none; }
}
