/* =========================================================================
   AURORA - design system and motion layer for the TDF-next panel (v2)
   Loaded after style.css. Page styles live in /styles/pages/ (one file per route).

   COMPONENT LIBRARY - use these in route templates, do not re-invent:
   Layout   .au-page          page container (max 1400px, vertical rhythm)
            .au-head          page hero: .au-kicker, .au-title, .au-lead, .au-actions
            .au-grid          12-column grid; children use .span-3 .span-4 .span-6 .span-8 .span-12
            .au-row           flex row with gap that wraps; add .between for space-between
            .au-stack         vertical flex with gap
   Surface  .au-tile          glass card; modifiers .pad-lg .glow (animated gradient edge) .interactive
            .au-section-head  title row inside a tile (h3, small, actions on the far side)
   Type     .au-kicker .au-title .au-lead .au-label .au-num .au-sub .au-mono .au-grad-text
   Data     .au-stat          label + big number + sub; .au-trend.up / .au-trend.down
            .au-badge         pill with dot; .ok .warn .bad .info, default neutral
            .au-chip          small tag
            .au-meter         progress track; its child b is the bar (set width inline)
            .au-list          list of .au-item rows: .au-ic, .au-main (b + small), .au-meta, .au-actions
            .au-table         glass table; wrap it in .au-table-wrap for horizontal scroll
            .au-empty         empty state: .au-empty-ic (animated orbit), b, small
            .au-skeleton      shimmer placeholder (set height); .line for a text line
   Form     .au-field         label + control + small hint
            .au-switch        label.au-switch wrapping a checkbox input and an empty span (the track)
            .au-seg           segmented control: label > input[type=radio] + span
            .au-banner        inline notice; .info .warn .bad .ok
   Motion   any element gets the entrance animation when it is a direct child of #view,
            .au-page, .au-grid, .au-list or .au-stack (stagger via --i, set by aurora.js).
            .au-reveal        appears when scrolled into view (aurora.js adds .is-in)
            .au-spot          mouse-follow light (aurora.js sets --mx --my); .au-tile.interactive has it
            window.auCelebrate(x, y)   particle burst for real successes
            window.auFlow(canvas, opts) live message-flow animation (dashboard)
   ========================================================================= */

:root {
  --au-bg: #05060d;
  --au-violet: #7c5cff;
  --au-blue: #5b8cff;
  --au-cyan: #22d3ee;
  --au-v-rgb: 124 92 255;
  --au-c-rgb: 34 211 238;
  --au-pink: #f472b6;
  --au-green: #3ddc97;
  --au-amber: #f7b84b;
  --au-red: #ff6b81;
  --au-tile: rgb(18 20 38 / .72);
  --au-tile-2: rgb(24 26 48 / .78);
  --au-glass: rgb(14 16 32 / .62);
  --au-glass-strong: rgb(16 18 36 / .82);
  --au-line: rgb(255 255 255 / .075);
  --au-line-strong: rgb(255 255 255 / .14);
  --au-shine: linear-gradient(180deg, rgb(255 255 255 / .06), rgb(255 255 255 / 0) 40%);
  --au-grad: linear-gradient(120deg, var(--au-violet) 0%, var(--au-blue) 50%, var(--au-cyan) 100%);
  --au-grad-warm: linear-gradient(120deg, var(--au-pink), var(--au-violet));
  --au-shadow:
    0 1px 0 rgb(255 255 255 / .055) inset,
    0 0 0 1px rgb(255 255 255 / .05),
    0 10px 30px -14px rgb(0 0 0 / .8),
    0 30px 70px -44px rgb(92 70 255 / .4);
  --au-shadow-hover:
    0 1px 0 rgb(255 255 255 / .09) inset,
    0 0 0 1px rgb(var(--au-v-rgb) / .36),
    0 18px 44px -18px rgb(0 0 0 / .85),
    0 44px 100px -44px rgb(92 70 255 / .6);
  --au-blur: blur(20px) saturate(160%);
  --au-r-sm: 12px;
  --au-r: 18px;
  --au-r-lg: 26px;
  --au-ease: var(--spring-default, cubic-bezier(.25, 1.1, .3, 1));
  --au-ease-snap: var(--spring-snappy, cubic-bezier(.22, 1.2, .36, 1));
  --au-ease-out: cubic-bezier(.16, 1, .3, 1);
  --accent: var(--au-violet);
  --accent-rgb: 124, 92, 255;
  --accent-gradient: var(--au-grad);
  --radius: var(--au-r);
  --radius-lg: var(--au-r-lg);
}

/* palette picker (theme popover): the aurora accents follow html[data-palette] */
html[data-palette="azure"] { --au-violet: #2f7cf6; --au-blue: #3b9bff; --au-cyan: #38bdf8; --au-v-rgb: 47 124 246; --au-c-rgb: 56 189 248; }
html[data-palette="emerald"] { --au-violet: #10b981; --au-blue: #14b8a6; --au-cyan: #34d399; --au-v-rgb: 16 185 129; --au-c-rgb: 52 211 153; }
html[data-palette="rose"] { --au-violet: #f43f5e; --au-blue: #ec4899; --au-cyan: #fb7185; --au-v-rgb: 244 63 94; --au-c-rgb: 251 113 133; }

/* ---------------------------------------------------------------- keyframes */
@keyframes auDrift { 0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); } 33% { transform: translate3d(5vw, 4vh, 0) rotate(8deg) scale(1.08); } 66% { transform: translate3d(-4vw, 6vh, 0) rotate(-6deg) scale(.96); } }
@keyframes auIn { from { opacity: 0; transform: translateY(16px) scale(.985); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes auFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes auSheen { from { transform: translateX(-140%) skewX(-18deg); } to { transform: translateX(260%) skewX(-18deg); } }
@keyframes auPulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes auSpin { to { transform: rotate(360deg); } }
@keyframes auFlowText { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes auShimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes auEdge { to { --au-angle: 360deg; } }
@keyframes auPop { 0% { transform: scale(.92); opacity: 0; } 60% { transform: scale(1.02); opacity: 1; } 100% { transform: scale(1); } }
@keyframes auToastIn { from { transform: translateY(18px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes auFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@property --au-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

/* ---------------------------------------------------------------- base */
html:not([data-theme="light"]) body { background: var(--au-bg); }
/* no global "tnum": Vazirmatn's tabular Persian digits get wide gaps (۱ ۰ ,۴) — tables opt in below */
body { font-feature-settings: normal; -webkit-font-smoothing: antialiased; }
td, th, time, .au-mono, .au-table { font-variant-numeric: tabular-nums; }
::selection { background: rgb(var(--au-v-rgb) / .45); color: #fff; }

/* living background: two drifting colour fields + a fading grid */
.app::before, .login-wrap::before {
  content: ''; position: fixed; inset: -25vmax; z-index: 0; pointer-events: none;
  background:
    radial-gradient(36vmax 28vmax at 20% 15%, rgb(var(--au-v-rgb) / .32), transparent 70%),
    radial-gradient(30vmax 26vmax at 85% 25%, rgb(var(--au-c-rgb) / .16), transparent 70%),
    radial-gradient(38vmax 30vmax at 55% 95%, rgb(244 114 182 / .14), transparent 70%);
  filter: blur(24px);
  animation: auDrift 46s ease-in-out infinite;
  will-change: transform;
}
.app::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgb(255 255 255 / .022) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / .022) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 25%, #000 25%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 25%, #000 25%, transparent 80%);
}
.app > .main { position: relative; z-index: 1; }
.app > .sidebar { z-index: 30; }
/* mobile drawer: must sit above its overlay (65), and open from the right edge,
   the same side as the menu button in RTL (inline-end was the left edge) */
@media (max-width: 768px) {
  .app > .sidebar { z-index: 70; inset-inline-start: 0; inset-inline-end: auto; }
  html[dir="ltr"] .app > .sidebar { transform: translateX(-102%); }
  html[dir="ltr"] .app > .sidebar.open { transform: none; }
}

/* ---------------------------------------------------------------- shell: sidebar */
@media (min-width: 981px) {
  .app { padding: 14px; gap: 14px; }
  .sidebar {
    position: sticky; top: 14px; height: calc(100dvh - 28px);
    border-radius: var(--au-r-lg); border: 0 !important;
    background: var(--au-glass) !important; backdrop-filter: var(--au-blur); -webkit-backdrop-filter: var(--au-blur);
    box-shadow: var(--au-shadow); overflow: hidden auto;
  }
}
/* z-index:-1 keeps the shine under the sidebar content (the sidebar is its own stacking context);
   without it the light theme's white shine washed out the brand at the top */
.sidebar::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--au-shine); pointer-events: none; border-radius: inherit; }
.brand { border-bottom: 1px solid var(--au-line) !important; }
.brand-copy b { font-weight: 900; letter-spacing: -.01em; }
.logo-cube { background: var(--au-grad) !important; box-shadow: 0 0 0 1px rgb(255 255 255 / .22) inset, 0 8px 26px -6px rgb(var(--au-v-rgb) / .85) !important; }
.nav-group-toggle { color: var(--muted) !important; font-weight: 800; }
#nav { position: relative; }
.nav-item {
  position: relative; z-index: 1; border-radius: 13px !important; border: 1px solid transparent !important;
  transition: color .25s, transform .4s var(--au-ease-snap) !important; background: transparent !important;
}
.nav-item:hover { color: var(--text-strong) !important; transform: translateX(-3px); }
.nav-item:hover:not(.active)::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: rgb(255 255 255 / .045); z-index: -1; }
.nav-item.active { color: #fff !important; }
.nav-item.active i svg { stroke: #fff; filter: drop-shadow(0 0 6px rgb(var(--au-v-rgb) / .9)); }
/* the sliding pill (positioned by aurora.js); falls back to a static highlight without JS */
.au-nav-indicator {
  position: absolute; z-index: 0; left: 0; right: 0; height: 0; top: 0; pointer-events: none; border-radius: 13px;
  background: linear-gradient(120deg, rgb(var(--au-v-rgb) / .32), rgb(var(--au-c-rgb) / .12));
  border: 1px solid rgb(var(--au-v-rgb) / .42);
  box-shadow: 0 12px 30px -12px rgb(var(--au-v-rgb) / .8), 0 1px 0 rgb(255 255 255 / .12) inset;
  transition: transform .6s var(--au-ease), height .6s var(--au-ease), opacity .3s;
}
.au-nav-indicator::after {
  content: ''; position: absolute; inset-inline-start: -13px; top: 24%; bottom: 24%; width: 4px; border-radius: 4px;
  background: var(--au-grad); box-shadow: 0 0 14px rgb(var(--au-v-rgb) / .95);
}
html:not(.au-js) .nav-item.active { background: linear-gradient(120deg, rgb(var(--au-v-rgb) / .3), rgb(var(--au-c-rgb) / .1)) !important; border-color: rgb(var(--au-v-rgb) / .4) !important; }

/* ---------------------------------------------------------------- shell: topbar */
.topbar {
  position: sticky; top: 14px; z-index: 20; margin: 0 0 20px !important;
  border-radius: 20px !important; border: 0 !important;
  background: var(--au-glass-strong) !important; backdrop-filter: var(--au-blur); -webkit-backdrop-filter: var(--au-blur);
  box-shadow: var(--au-shadow) !important;
}
@media (max-width: 980px) { .topbar { top: 8px; margin: 8px 8px 16px !important; } }
.topbar-title h1 { font-weight: 900; letter-spacing: -.02em; }
.topbar-title small { color: var(--muted); }
.topbar-tool, .icon-btn {
  background: rgb(255 255 255 / .04) !important; border: 1px solid var(--au-line) !important; border-radius: 13px !important;
  transition: transform .35s var(--au-ease-snap), background .25s, border-color .25s !important;
}
.topbar-tool:hover, .icon-btn:hover { transform: translateY(-1px); background: rgb(255 255 255 / .08) !important; border-color: var(--au-line-strong) !important; }
.command-trigger { min-width: 230px; justify-content: flex-start; }
.command-trigger kbd { margin-inline-start: auto; }
/* the palette's input sits inside its own bordered label: no second box */
#command-search, #command-search:focus, #command-search:hover { border: 0 !important; background: transparent !important; box-shadow: none !important; padding-inline: 0 !important; }
.command-search { background: rgb(6 8 18 / .55); border-color: var(--au-line-strong); }
html[data-theme="light"] .command-search { background: #fff; }
/* solid on purpose: a see-through bar let page text show behind the tab labels */
.mobile-nav { background: rgb(12 13 26) !important; backdrop-filter: none; -webkit-backdrop-filter: none; border-top: 1px solid var(--au-line) !important; }
html[data-theme="light"] .mobile-nav { background: #fff !important; }

/* ---------------------------------------------------------------- legacy surfaces get the glass look */
.card, .forward-card, .dashboard-disclosure, .xs-card, .xs-kpis article, .delivery-stat {
  background: var(--au-tile) !important; border: 0 !important; box-shadow: var(--au-shadow) !important;
  border-radius: var(--au-r) !important; position: relative;
}
.card, .forward-card, .xs-card { isolation: isolate; }
.card::before, .forward-card::before, .xs-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--au-shine); pointer-events: none;
}
.modal, .notif-popover, .theme-popover {
  background: var(--au-glass-strong) !important; border: 0 !important;
  backdrop-filter: var(--au-blur); -webkit-backdrop-filter: var(--au-blur);
  box-shadow: var(--au-shadow), 0 40px 120px -20px rgb(0 0 0 / .7) !important; border-radius: var(--au-r-lg) !important;
}
.modal { animation: auPop .5s var(--au-ease) both; }
/* popovers live inside the glass topbar: a nested backdrop-filter only sees the topbar,
   so the page text showed straight through them. Keep them (almost) opaque. */
.notif-popover, .theme-popover { background: rgb(13 15 30) !important; }
html[data-theme="light"] .notif-popover, html[data-theme="light"] .theme-popover { background: #fff !important; }
.modal-bg { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: auFade .25s ease both; }
/* mobile bottom-sheet: the sticky header used the old surface colour, a dark band on the glass sheet */
@media (max-width: 768px) {
  .modal-head { background: rgb(17 19 38 / .97) !important; backdrop-filter: none !important; }
  html[data-theme="light"] .modal-head { background: rgb(255 255 255 / .97) !important; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  border-radius: 13px !important; border: 1px solid var(--au-line) !important; background: rgb(255 255 255 / .05) !important;
  font-weight: 800; position: relative; overflow: hidden; isolation: isolate;
  transition: transform .35s var(--au-ease-snap), box-shadow .3s, background .25s, border-color .25s, color .2s !important;
}
.btn:hover:not(:disabled) { background: rgb(255 255 255 / .09) !important; border-color: var(--au-line-strong) !important; transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: var(--au-grad) !important; border-color: transparent !important; color: #fff !important;
  box-shadow: 0 10px 28px -10px rgb(var(--au-v-rgb) / .9), 0 1px 0 rgb(255 255 255 / .28) inset !important;
}
.btn.primary::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 42%; z-index: -1;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / .38), transparent); transform: translateX(-140%) skewX(-18deg);
}
.btn.primary:hover:not(:disabled)::after { animation: auSheen .9s var(--au-ease-out); }
.btn.danger { color: #ffa1b0 !important; border-color: rgb(255 107 129 / .32) !important; background: rgb(255 107 129 / .08) !important; }
.btn.danger:hover:not(:disabled) { background: rgb(255 107 129 / .16) !important; }
.btn.ghost { background: transparent !important; color: var(--text-soft, var(--text)); }

/* ---------------------------------------------------------------- fields */
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]), select, textarea {
  background: rgb(6 8 18 / .55) !important; border: 1px solid var(--au-line) !important; border-radius: 13px !important;
  transition: border-color .25s, box-shadow .35s var(--au-ease), background .25s !important;
}
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: var(--au-line-strong) !important; }
input:focus, select:focus, textarea:focus {
  border-color: rgb(var(--au-v-rgb) / .75) !important; outline: none;
  box-shadow: 0 0 0 4px rgb(var(--au-v-rgb) / .18), 0 0 26px -6px rgb(var(--au-v-rgb) / .6) !important;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--au-violet); }
input[type="range"] { accent-color: var(--au-violet); }

/* ---------------------------------------------------------------- legacy badges */
.badge { border-radius: 999px !important; font-weight: 800; border: 1px solid var(--au-line) !important; background: rgb(255 255 255 / .05) !important; }
.badge.ok { color: #6ee7b0 !important; background: rgb(61 220 151 / .1) !important; border-color: rgb(61 220 151 / .3) !important; }
.badge.off { color: #ffa1b0 !important; background: rgb(255 107 129 / .1) !important; border-color: rgb(255 107 129 / .3) !important; }

/* ---------------------------------------------------------------- toasts */
.toast, #toast > *, .toasts > * { animation: auToastIn .5s var(--au-ease) both; }

/* =========================================================================
   COMPONENT LIBRARY
   ========================================================================= */
.au-page { display: grid; gap: 18px; max-width: 1400px; margin-inline: auto; width: 100%; padding-bottom: 24px; }
.au-head {
  position: relative; overflow: hidden; border-radius: var(--au-r-lg); padding: 26px 28px;
  background:
    radial-gradient(110% 160% at 100% 0%, rgb(var(--au-v-rgb) / .30), transparent 55%),
    radial-gradient(80% 140% at 0% 100%, rgb(var(--au-c-rgb) / .12), transparent 60%),
    var(--au-tile);
  box-shadow: var(--au-shadow);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: end;
}
.au-head::before { content: ''; position: absolute; inset: 0; background: var(--au-shine); pointer-events: none; }
.au-head > * { position: relative; }
.au-kicker {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content;
  font-size: 12px; font-weight: 800; letter-spacing: .02em; color: #c4b8ff;
  padding: 5px 11px; border-radius: 999px; background: rgb(var(--au-v-rgb) / .14); border: 1px solid rgb(var(--au-v-rgb) / .32);
}
.au-kicker i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; color: inherit; animation: auPulse 2s infinite; }
.au-title { margin: 10px 0 6px; font-size: 30px; line-height: 1.2; font-weight: 900; letter-spacing: -.025em; color: var(--text-strong, #fff); }
.au-lead { margin: 0; color: var(--text-soft); max-width: 70ch; font-size: 14.5px; line-height: 1.8; }
.au-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.au-grad-text {
  background: linear-gradient(110deg, #fff 15%, #c9bcff 40%, #8ff0ff 65%, #fff 90%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: auFlowText 10s ease-in-out infinite;
}

.au-grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.au-grid > * { grid-column: span 12; min-width: 0; }
.au-grid > .span-2 { grid-column: span 2; } .au-grid > .span-3 { grid-column: span 3; }
.au-grid > .span-4 { grid-column: span 4; } .au-grid > .span-5 { grid-column: span 5; }
.au-grid > .span-6 { grid-column: span 6; } .au-grid > .span-7 { grid-column: span 7; }
.au-grid > .span-8 { grid-column: span 8; } .au-grid > .span-9 { grid-column: span 9; }
.au-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.au-row.between { justify-content: space-between; }
.au-stack { display: flex; flex-direction: column; gap: 12px; }

.au-tile {
  position: relative; border-radius: var(--au-r); padding: 18px 20px; min-width: 0;
  background: var(--au-tile); box-shadow: var(--au-shadow); color: var(--text);
  transition: transform .5s var(--au-ease), box-shadow .5s var(--au-ease);
}
.au-tile::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--au-shine); pointer-events: none; }
.au-tile > * { position: relative; }
.au-tile.pad-lg { padding: 26px 28px; }
.au-tile.interactive { cursor: pointer; }
.au-tile.interactive:hover, a.au-tile:hover { transform: translateY(-4px); box-shadow: var(--au-shadow-hover); }
a.au-tile { text-decoration: none; display: block; }
.au-tile.glow::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--au-angle), var(--au-violet), var(--au-cyan), var(--au-pink), var(--au-violet));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: auEdge 6s linear infinite; opacity: .85;
}
/* mouse-follow light (aurora.js writes --mx/--my) */
.au-spot, .au-tile.interactive, a.au-tile { --mx: 50%; --my: 50%; }
.au-spot::after, .au-tile.interactive:not(.glow)::after, a.au-tile:not(.glow)::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(360px circle at var(--mx) var(--my), rgb(var(--au-v-rgb) / .16), transparent 45%);
  transition: opacity .35s;
}
.au-spot:hover::after, .au-tile.interactive:hover::after, a.au-tile:hover::after { opacity: 1; }

.au-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.au-section-head h3 { margin: 0; font-size: 16px; font-weight: 900; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.au-section-head small { color: var(--muted); }
.au-section-head > :last-child:not(h3):not(small) { margin-inline-start: auto; }

.au-label { font-size: 12.5px; color: var(--muted); font-weight: 800; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.au-label svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.au-num { display: block; font-size: 34px; line-height: 1.12; font-weight: 900; letter-spacing: -.03em; margin: 8px 0 2px; font-variant-numeric: normal; color: var(--text-strong, #fff); }
.au-sub { font-size: 12.5px; color: var(--muted); }
.au-mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; direction: ltr; unicode-bidi: isolate; }
.au-stat { display: flex; flex-direction: column; }
.au-trend { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; width: fit-content; }
.au-trend.up { color: #6ee7b0; background: rgb(61 220 151 / .12); }
.au-trend.down { color: #ffa1b0; background: rgb(255 107 129 / .12); }

.au-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 800; color: var(--text-soft); background: rgb(255 255 255 / .06); border: 1px solid var(--au-line);
}
.au-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.au-badge.ok { color: #6ee7b0; background: rgb(61 220 151 / .1); border-color: rgb(61 220 151 / .3); }
.au-badge.ok::before { animation: auPulse 2s infinite; }
.au-badge.warn { color: #f9c66c; background: rgb(247 184 75 / .1); border-color: rgb(247 184 75 / .32); }
.au-badge.bad { color: #ffa1b0; background: rgb(255 107 129 / .1); border-color: rgb(255 107 129 / .32); }
.au-badge.info { color: #8fd8ff; background: rgb(var(--au-c-rgb) / .1); border-color: rgb(var(--au-c-rgb) / .3); }
.au-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 8px; font-size: 12px; background: rgb(255 255 255 / .05); border: 1px solid var(--au-line); color: var(--text-soft); }

.au-meter { height: 8px; border-radius: 99px; background: rgb(255 255 255 / .07); overflow: hidden; }
.au-meter > b { display: block; height: 100%; border-radius: inherit; background: var(--au-grad); box-shadow: 0 0 12px rgb(var(--au-v-rgb) / .7); transition: width 1.2s var(--au-ease); }
.au-meter.ok > b { background: linear-gradient(90deg, #22c493, #3ddc97); box-shadow: 0 0 12px rgb(61 220 151 / .6); }
.au-meter.bad > b { background: linear-gradient(90deg, #ff5a77, #ff8fa0); box-shadow: 0 0 12px rgb(255 107 129 / .6); }

.au-list { display: flex; flex-direction: column; gap: 8px; }
.au-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; background: rgb(255 255 255 / .03); border: 1px solid transparent;
  transition: background .25s, border-color .25s, transform .4s var(--au-ease-snap);
}
.au-item:hover { background: rgb(255 255 255 / .055); border-color: var(--au-line); transform: translateX(-2px); }
.au-ic {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; overflow: hidden;
  background: linear-gradient(140deg, rgb(var(--au-v-rgb) / .32), rgb(var(--au-c-rgb) / .14)); box-shadow: 0 0 0 1px rgb(255 255 255 / .08) inset;
}
.au-ic svg { width: 19px; height: 19px; stroke: #fff; fill: none; stroke-width: 2; }
.au-ic img { width: 100%; height: 100%; object-fit: cover; }
.au-ic.tg { background: linear-gradient(140deg, #2aabee, #1d7ec2); }
.au-ic.dc { background: linear-gradient(140deg, #6875f5, #4752c4); }
.au-ic.self { background: linear-gradient(140deg, #f7b84b, #d9822b); }
.au-main { min-width: 0; }
.au-main b { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Latin channel names: cut the tail, not the head ("…m-pro [Digileak]"), but keep the RTL right edge */
.au-main b, .au-main small { unicode-bidi: plaintext; text-align: right; }
html[dir="ltr"] .au-main b, html[dir="ltr"] .au-main small { text-align: left; }
.au-main small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.au-actions-inline, .au-item .au-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.au-table-wrap { overflow-x: auto; border-radius: var(--au-r); }
.au-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.au-table th { position: sticky; top: 0; z-index: 1; text-align: start; font-size: 12px; font-weight: 800; color: var(--muted); padding: 11px 14px; background: rgb(14 16 32 / .92); border-bottom: 1px solid var(--au-line); white-space: nowrap; }
.au-table td { padding: 12px 14px; border-bottom: 1px solid rgb(255 255 255 / .04); vertical-align: middle; }
.au-table tbody tr { transition: background .2s; }
.au-table tbody tr:hover { background: rgb(var(--au-v-rgb) / .06); }
.au-table tbody tr:last-child td { border-bottom: 0; }

.au-empty { display: grid; justify-items: center; gap: 8px; padding: 42px 20px; text-align: center; color: var(--muted); }
.au-empty b { color: var(--text); font-size: 15px; }
.au-empty small { max-width: 46ch; line-height: 1.8; }
.au-empty-ic { position: relative; width: 74px; height: 74px; display: grid; place-items: center; margin-bottom: 6px; }
.au-empty-ic::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1px dashed rgb(var(--au-v-rgb) / .45); animation: auSpin 14s linear infinite; }
.au-empty-ic::after { content: ''; position: absolute; top: -3px; left: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--au-cyan); box-shadow: 0 0 14px var(--au-cyan); transform-origin: 0 40px; animation: auSpin 14s linear infinite; }
.au-empty-ic svg { width: 30px; height: 30px; stroke: #c4b8ff; fill: none; stroke-width: 1.8; animation: auFloat 4s ease-in-out infinite; }

.au-skeleton {
  border-radius: 12px; min-height: 16px;
  background: linear-gradient(90deg, rgb(255 255 255 / .04) 25%, rgb(255 255 255 / .1) 50%, rgb(255 255 255 / .04) 75%);
  background-size: 200% 100%; animation: auShimmer 1.6s linear infinite;
}
.au-skeleton.line { height: 12px; border-radius: 6px; }

.au-field { display: grid; gap: 6px; }
.au-field > label, .au-field > span:first-child { font-size: 13px; font-weight: 800; color: var(--text-soft); }
.au-field > small { color: var(--muted); font-size: 12px; line-height: 1.7; }

.au-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.au-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.au-switch > span { position: relative; width: 44px; height: 26px; border-radius: 99px; background: rgb(255 255 255 / .1); border: 1px solid var(--au-line-strong); transition: background .3s, border-color .3s; flex: none; }
.au-switch > span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .4); transition: transform .45s var(--au-ease-snap); }
.au-switch input:checked + span { background: var(--au-grad); border-color: transparent; box-shadow: 0 0 18px -4px rgb(var(--au-v-rgb) / .8); }
.au-switch input:checked + span::after { transform: translateX(-18px); }
html[dir="ltr"] .au-switch input:checked + span::after { transform: translateX(18px); }
.au-switch input:focus-visible + span { box-shadow: 0 0 0 4px rgb(var(--au-v-rgb) / .25); }

.au-seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: rgb(255 255 255 / .04); border: 1px solid var(--au-line); flex-wrap: wrap; }
.au-seg label { cursor: pointer; }
.au-seg input { position: absolute; opacity: 0; pointer-events: none; }
.au-seg span { display: inline-block; padding: 7px 14px; border-radius: 10px; font-size: 13px; font-weight: 800; color: var(--muted); transition: background .3s var(--au-ease), color .2s, box-shadow .3s; }
.au-seg input:checked + span { background: var(--au-grad); color: #fff; box-shadow: 0 6px 18px -6px rgb(var(--au-v-rgb) / .9); }
.au-seg input:focus-visible + span { box-shadow: 0 0 0 3px rgb(var(--au-v-rgb) / .3); }

.au-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.8; background: rgb(255 255 255 / .04); border: 1px solid var(--au-line); }
.au-banner.info { background: rgb(var(--au-c-rgb) / .07); border-color: rgb(var(--au-c-rgb) / .25); }
.au-banner.warn { background: rgb(247 184 75 / .07); border-color: rgb(247 184 75 / .28); }
.au-banner.bad { background: rgb(255 107 129 / .07); border-color: rgb(255 107 129 / .28); }
.au-banner.ok { background: rgb(61 220 151 / .07); border-color: rgb(61 220 151 / .25); }

/* ---------------------------------------------------------------- entrance motion */
/* only while the router plays a page entrance (core.js adds .is-entering for ~1.8s);
   periodic re-renders (monitor every 5s, x-studio polling) must not fade the page out again */
#view.is-entering > *, #view.is-entering :is(.au-page, .au-grid, .au-list, .au-stack) > * {
  animation: auIn .7s var(--au-ease) both;
  animation-delay: calc(min(var(--i, 0), 12) * 45ms);
}
.au-reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--au-ease-out), transform .8s var(--au-ease); }
.au-reveal.is-in { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .au-grid > .span-2, .au-grid > .span-3 { grid-column: span 6; }
  .au-grid > .span-4, .au-grid > .span-5 { grid-column: span 6; }
  .au-grid > .span-7, .au-grid > .span-8, .au-grid > .span-9 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .au-grid { gap: 12px; }
  .au-grid > * { grid-column: span 12 !important; }
  .au-head { grid-template-columns: 1fr; padding: 20px; }
  .au-actions { justify-content: flex-start; }
  .au-title { font-size: 24px; }
  .au-item { grid-template-columns: auto minmax(0, 1fr); }
  .au-item .au-meta, .au-item .au-actions { grid-column: 2; justify-content: flex-start; }
  .command-trigger { min-width: 0; }
}

/* ---------------------------------------------------------------- light theme */
html[data-theme="light"] {
  --au-tile: rgb(255 255 255 / .82); --au-tile-2: #fff;
  --au-glass: rgb(255 255 255 / .7); --au-glass-strong: rgb(255 255 255 / .86);
  --au-line: rgb(30 30 70 / .09); --au-line-strong: rgb(30 30 70 / .16);
  --au-shine: linear-gradient(180deg, rgb(255 255 255 / .9), rgb(255 255 255 / 0) 40%);
  --au-shadow: 0 1px 0 #fff inset, 0 0 0 1px rgb(30 30 80 / .07), 0 10px 28px -16px rgb(30 30 80 / .3), 0 30px 60px -44px rgb(92 70 255 / .32);
  --au-shadow-hover: 0 1px 0 #fff inset, 0 0 0 1px rgb(var(--au-v-rgb) / .32), 0 18px 40px -18px rgb(30 30 80 / .35), 0 44px 90px -44px rgb(92 70 255 / .45);
}
html[data-theme="light"] body { background: #f2f1fb; }
html[data-theme="light"] .app::before { opacity: .5; }
html[data-theme="light"] .app::after { opacity: .5; filter: invert(1); }
html[data-theme="light"] .au-grad-text { background-image: linear-gradient(110deg, #1b1340 15%, #6a4dff 40%, #0aa5c4 65%, #1b1340 90%); }
html[data-theme="light"] .au-title, html[data-theme="light"] .au-num { color: #17123a; }
html[data-theme="light"] .au-kicker { color: #5a3fe0; }
html[data-theme="light"] .nav-item.active { color: #24186a !important; }
html[data-theme="light"] .nav-item.active i svg { stroke: #5a3fe0; filter: none; }
html[data-theme="light"] .au-ic:not(.tg):not(.dc) svg { stroke: #5a3fe0; }
html[data-theme="light"] .btn.danger { color: #c5243f !important; border-color: rgb(216 52 79 / .35) !important; }
html[data-theme="light"] .au-nav-indicator { background: linear-gradient(120deg, rgb(var(--au-v-rgb) / .16), rgb(var(--au-c-rgb) / .08)); border-color: rgb(var(--au-v-rgb) / .32); box-shadow: 0 10px 24px -14px rgb(var(--au-v-rgb) / .6); }
html[data-theme="light"] .au-badge.ok, html[data-theme="light"] .badge.ok { color: #0f8a5a !important; }
html[data-theme="light"] .au-badge.warn { color: #9a6200; }
html[data-theme="light"] .au-badge.bad, html[data-theme="light"] .badge.off { color: #c8304d !important; }
html[data-theme="light"] .au-badge.info { color: #0b7fa0; }
html[data-theme="light"] .au-kicker { background: rgb(var(--au-v-rgb) / .1); }
html[data-theme="light"] .au-trend.up { color: #0f8a5a; }
html[data-theme="light"] .au-trend.down { color: #c8304d; }
html[data-theme="light"] .au-table th { background: rgb(246 245 253 / .95); }
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]),
html[data-theme="light"] select, html[data-theme="light"] textarea { background: rgb(255 255 255 / .85) !important; }
html[data-theme="light"] .au-item { background: rgb(30 30 80 / .03); }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .app::before, .login-wrap::before { animation: none !important; }
  .au-reveal { opacity: 1; transform: none; }
}
