index.css 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. @import "tailwindcss";
  2. @import "tw-animate-css";
  3. @custom-variant dark (&:is(.dark *));
  4. /* NetPulse design tokens — dark-first (design.md §3). Default = dark "NOC doméstico". */
  5. /* .dark permite forzar el tema oscuro en previews dentro de páginas claras */
  6. @layer base {
  7. :root,
  8. .dark {
  9. --canvas: 7 11 18; /* #070B12 */
  10. --surface: 13 20 32; /* #0D1420 */
  11. --elevated: 19 28 44; /* #131C2C */
  12. --hover: 26 36 54; /* #1A2436 */
  13. --border: 30 42 61; /* #1E2A3D */
  14. --border-strong: 42 58 82; /* #2A3A52 */
  15. --text-primary: 232 238 247; /* #E8EEF7 */
  16. --text-secondary: 154 168 188; /* #9AA8BC */
  17. --text-muted: 91 107 130; /* #5B6B82 */
  18. --accent: 34 211 238; /* #22D3EE cyan-400 */
  19. --tunnel: 167 139 250; /* #A78BFA violet-400 */
  20. --ok: 52 211 153; /* #34D399 emerald-400 */
  21. --warn: 251 191 36; /* #FBBF24 amber-400 */
  22. --danger: 248 113 113; /* #F87171 red-400 */
  23. --info: 96 165 250; /* #60A5FA blue-400 */
  24. --radius: 0.625rem; /* 10px */
  25. color-scheme: dark;
  26. }
  27. /* Light theme — toggled via .light class on <html> (o en un contenedor para previews) */
  28. html.light,
  29. .light {
  30. --canvas: 243 245 249; /* #F3F5F9 */
  31. --surface: 255 255 255;
  32. --elevated: 255 255 255;
  33. --hover: 241 245 249; /* slate-100 */
  34. --border: 226 232 240; /* #E2E8F0 */
  35. --border-strong: 203 213 225;
  36. --text-primary: 15 23 42; /* #0F172A */
  37. --text-secondary: 71 85 105; /* #475569 */
  38. --text-muted: 100 116 139; /* slate-500, AA sobre surface */
  39. --accent: 8 145 178; /* #0891B2 cyan-600 */
  40. --tunnel: 124 58 237; /* violet-600 */
  41. --ok: 5 150 105; /* emerald-600 */
  42. --warn: 217 119 6; /* amber-600 */
  43. --danger: 220 38 38; /* red-600 */
  44. --info: 37 99 235; /* blue-600 */
  45. color-scheme: light;
  46. }
  47. }
  48. /* Design tokens → Tailwind 4 @theme (equivalente al theme.extend de v3).
  49. En v4 los colores van PUROS (sin <alpha-value>); la opacidad (bg-x/50)
  50. la gestiona Tailwind con color-mix automático. */
  51. @theme {
  52. --color-canvas: rgb(var(--canvas));
  53. --color-surface: rgb(var(--surface));
  54. --color-elevated: rgb(var(--elevated));
  55. --color-hover: rgb(var(--hover));
  56. --color-border: rgb(var(--border));
  57. --color-border-strong: rgb(var(--border-strong));
  58. --color-text-primary: rgb(var(--text-primary));
  59. --color-text-secondary: rgb(var(--text-secondary));
  60. --color-text-muted: rgb(var(--text-muted));
  61. --color-accent: rgb(var(--accent));
  62. --color-accent-soft: rgb(var(--accent) / 0.12);
  63. --color-tunnel: rgb(var(--tunnel));
  64. --color-ok: rgb(var(--ok));
  65. --color-warn: rgb(var(--warn));
  66. --color-danger: rgb(var(--danger));
  67. --color-info: rgb(var(--info));
  68. /* shadcn/ui aliases mapeados a los tokens de diseño */
  69. --color-background: rgb(var(--canvas));
  70. --color-foreground: rgb(var(--text-primary));
  71. --color-input: rgb(var(--border-strong));
  72. --color-ring: rgb(var(--accent));
  73. --color-primary: rgb(var(--accent));
  74. --color-primary-foreground: rgb(var(--canvas));
  75. --color-secondary: rgb(var(--elevated));
  76. --color-secondary-foreground: rgb(var(--text-primary));
  77. --color-destructive: rgb(var(--danger));
  78. --color-destructive-foreground: rgb(var(--canvas));
  79. --color-muted: rgb(var(--elevated));
  80. --color-muted-foreground: rgb(var(--text-muted));
  81. --color-popover: rgb(var(--elevated));
  82. --color-popover-foreground: rgb(var(--text-primary));
  83. --color-card: rgb(var(--surface));
  84. --color-card-foreground: rgb(var(--text-primary));
  85. --color-sidebar: rgb(var(--surface));
  86. --color-sidebar-foreground: rgb(var(--text-primary));
  87. --color-sidebar-primary: rgb(var(--accent));
  88. --color-sidebar-primary-foreground: rgb(var(--canvas));
  89. --color-sidebar-accent: rgb(var(--accent) / 0.12);
  90. --color-sidebar-accent-foreground: rgb(var(--accent));
  91. --color-sidebar-border: rgb(var(--border));
  92. --color-sidebar-ring: rgb(var(--accent));
  93. --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  94. --font-sans: Inter, ui-sans-serif, system-ui, sans-serif;
  95. --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  96. --text-display: 2.75rem;
  97. --text-display--line-height: 1.1;
  98. --text-display--font-weight: 700;
  99. --text-display-sm: 2.25rem;
  100. --text-display-sm--line-height: 1.1;
  101. --text-display-sm--font-weight: 700;
  102. --text-h1: 1.5rem;
  103. --text-h1--line-height: 1.2;
  104. --text-h1--font-weight: 600;
  105. --text-h2: 1.125rem;
  106. --text-h2--line-height: 1.3;
  107. --text-h2--font-weight: 600;
  108. --text-stat: 1.75rem;
  109. --text-stat--line-height: 1.1;
  110. --text-stat--font-weight: 600;
  111. --text-label: 0.75rem;
  112. --text-label--line-height: 1.4;
  113. --text-label--font-weight: 500;
  114. --text-label--letter-spacing: 0.06em;
  115. --text-caption: 0.6875rem;
  116. --text-caption--line-height: 1.4;
  117. --text-caption--font-weight: 500;
  118. --text-mono-sm: 0.75rem;
  119. --text-mono-sm--line-height: 1.4;
  120. --text-mono-sm--font-weight: 500;
  121. --radius-xs: calc(var(--radius) - 6px);
  122. --radius-sm: calc(var(--radius) - 4px);
  123. --radius-md: calc(var(--radius) - 2px);
  124. --radius-lg: var(--radius);
  125. --radius-xl: calc(var(--radius) + 2px);
  126. --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  127. --shadow-glow-ok: 0 0 40px -12px rgb(var(--ok) / 0.35);
  128. --shadow-glow-warn: 0 0 40px -12px rgb(var(--warn) / 0.35);
  129. --shadow-glow-danger: 0 0 40px -12px rgb(var(--danger) / 0.35);
  130. --shadow-glow-accent: 0 0 40px -12px rgb(var(--accent) / 0.35);
  131. --shadow-glow-tunnel: 0 0 40px -12px rgb(var(--tunnel) / 0.35);
  132. --animate-accordion-down: accordion-down 0.2s ease-out;
  133. --animate-accordion-up: accordion-up 0.2s ease-out;
  134. --animate-caret-blink: caret-blink 1.25s ease-out infinite;
  135. --animate-ping-soft: ping-soft 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
  136. @keyframes accordion-down {
  137. from { height: 0; }
  138. to { height: var(--radix-accordion-content-height); }
  139. }
  140. @keyframes accordion-up {
  141. from { height: var(--radix-accordion-content-height); }
  142. to { height: 0; }
  143. }
  144. @keyframes caret-blink {
  145. 0%, 70%, 100% { opacity: 1; }
  146. 20%, 50% { opacity: 0; }
  147. }
  148. @keyframes ping-soft {
  149. 0% { transform: scale(1); opacity: 0.7; }
  150. 80%, 100% { transform: scale(2.2); opacity: 0; }
  151. }
  152. }
  153. @layer base {
  154. * {
  155. @apply border-border;
  156. }
  157. html {
  158. -webkit-tap-highlight-color: transparent;
  159. }
  160. body {
  161. @apply bg-canvas text-text-primary font-sans antialiased;
  162. font-size: 0.875rem;
  163. line-height: 1.5;
  164. transition: background-color 200ms ease, color 200ms ease;
  165. }
  166. .font-mono,
  167. code,
  168. kbd {
  169. font-feature-settings: "tnum";
  170. }
  171. ::selection {
  172. background: rgb(var(--accent) / 0.25);
  173. }
  174. :focus-visible {
  175. outline: 2px solid rgb(var(--accent));
  176. outline-offset: 2px;
  177. border-radius: 4px;
  178. }
  179. /* Scrollbar discreto acorde al tema */
  180. ::-webkit-scrollbar {
  181. width: 10px;
  182. height: 10px;
  183. }
  184. ::-webkit-scrollbar-thumb {
  185. background: rgb(var(--border-strong));
  186. border-radius: 999px;
  187. border: 2px solid rgb(var(--canvas));
  188. }
  189. ::-webkit-scrollbar-track {
  190. background: transparent;
  191. }
  192. }
  193. @layer utilities {
  194. /* Surface hierarchy (#21): elevated cards get accent glow + stronger border */
  195. .surface-elevated {
  196. border-color: rgb(var(--border-strong));
  197. box-shadow:
  198. 0 0 0 1px rgb(var(--accent) / 0.08),
  199. 0 4px 24px -8px rgb(var(--accent) / 0.12);
  200. }
  201. .surface-featured {
  202. border-color: rgb(var(--accent) / 0.25);
  203. background: linear-gradient(
  204. 135deg,
  205. rgb(var(--surface)) 0%,
  206. rgb(var(--accent) / 0.03) 100%
  207. );
  208. box-shadow:
  209. 0 0 0 1px rgb(var(--accent) / 0.1),
  210. 0 8px 32px -12px rgb(var(--accent) / 0.18);
  211. }
  212. /* Status glows (#21): subtle border glow for health states */
  213. .glow-ok { box-shadow: 0 0 20px -8px rgb(var(--ok) / 0.3); }
  214. .glow-warn { box-shadow: 0 0 20px -8px rgb(var(--warn) / 0.3); }
  215. .glow-danger { box-shadow: 0 0 20px -8px rgb(var(--danger) / 0.3); }
  216. .glow-accent { box-shadow: 0 0 20px -8px rgb(var(--accent) / 0.3); }
  217. /* KPI typography (#22): display font + tabular nums for hero metrics */
  218. .kpi-value {
  219. font-family: var(--font-display);
  220. font-feature-settings: "tnum";
  221. font-variant-numeric: tabular-nums;
  222. letter-spacing: -0.02em;
  223. }
  224. .kpi-delta-up {
  225. color: rgb(var(--ok));
  226. }
  227. .kpi-delta-down {
  228. color: rgb(var(--danger));
  229. }
  230. .kpi-delta-flat {
  231. color: rgb(var(--text-muted));
  232. }
  233. /* SSE flash (#22): brief highlight when a value updates via SSE */
  234. .flash-sse {
  235. animation: kpi-flash 0.6s ease-out;
  236. }
  237. @keyframes kpi-flash {
  238. 0% { background-color: rgb(var(--accent) / 0.15); }
  239. 100% { background-color: transparent; }
  240. }
  241. /* Count-up entrance (#22) */
  242. .count-up-enter {
  243. animation: count-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  244. }
  245. @keyframes count-up {
  246. from { opacity: 0; transform: translateY(8px); }
  247. to { opacity: 1; transform: translateY(0); }
  248. }
  249. /* Safe areas (PWA, design.md §12) */
  250. .pt-safe {
  251. padding-top: env(safe-area-inset-top);
  252. }
  253. .pb-safe {
  254. padding-bottom: env(safe-area-inset-bottom);
  255. }
  256. .pl-safe {
  257. padding-left: env(safe-area-inset-left);
  258. }
  259. .pr-safe {
  260. padding-right: env(safe-area-inset-right);
  261. }
  262. .h-tabbar {
  263. height: calc(4rem + env(safe-area-inset-bottom));
  264. }
  265. .mesh-bg {
  266. background-image: url('/mesh-texture.svg');
  267. background-repeat: repeat;
  268. background-size: 400px 400px;
  269. }
  270. .text-balance {
  271. text-wrap: balance;
  272. }
  273. }
  274. /* Reduced motion: desactiva pulses/tweens (design.md §8, §13) */
  275. @media (prefers-reduced-motion: reduce) {
  276. *,
  277. *::before,
  278. *::after {
  279. animation-duration: 0.01ms !important;
  280. animation-iteration-count: 1 !important;
  281. transition-duration: 0.01ms !important;
  282. scroll-behavior: auto !important;
  283. }
  284. }
  285. /* Transición móvil entre vistas: el contenido (<main>) se desliza y el shell
  286. * (header móvil + bottom nav) permanece estático. Se capturan como grupos de
  287. * view-transition PROPIO (netpulse-header/netpulse-nav) para no depender de
  288. * cómo el navegador capture el grupo root con position:fixed (falla en
  289. * dispositivos). */
  290. @media (max-width: 767px) {
  291. main {
  292. view-transition-name: netpulse-content;
  293. }
  294. /* El shell queda estático: anulamos las 4 animaciones UA de cada grupo
  295. * (group/image-pair arrancan en opacity 0 en la hoja UA del navegador). */
  296. ::view-transition-group(root),
  297. ::view-transition-image-pair(root),
  298. ::view-transition-old(root),
  299. ::view-transition-new(root),
  300. ::view-transition-group(netpulse-header),
  301. ::view-transition-image-pair(netpulse-header),
  302. ::view-transition-old(netpulse-header),
  303. ::view-transition-new(netpulse-header),
  304. ::view-transition-group(netpulse-nav),
  305. ::view-transition-image-pair(netpulse-nav),
  306. ::view-transition-old(netpulse-nav),
  307. ::view-transition-new(netpulse-nav) {
  308. animation: none;
  309. }
  310. html[data-nav-dir='forward']::view-transition-old(netpulse-content) {
  311. animation: netpulse-vt-out-left 0.3s ease-in-out both;
  312. }
  313. html[data-nav-dir='forward']::view-transition-new(netpulse-content) {
  314. animation: netpulse-vt-in-right 0.3s ease-in-out both;
  315. }
  316. html[data-nav-dir='back']::view-transition-old(netpulse-content) {
  317. animation: netpulse-vt-out-right 0.3s ease-in-out both;
  318. }
  319. html[data-nav-dir='back']::view-transition-new(netpulse-content) {
  320. animation: netpulse-vt-in-left 0.3s ease-in-out both;
  321. }
  322. }
  323. @keyframes netpulse-vt-out-left {
  324. to {
  325. transform: translateX(-24%);
  326. opacity: 0.7;
  327. }
  328. }
  329. @keyframes netpulse-vt-in-right {
  330. from {
  331. transform: translateX(24%);
  332. opacity: 0.7;
  333. }
  334. }
  335. @keyframes netpulse-vt-out-right {
  336. to {
  337. transform: translateX(24%);
  338. opacity: 0.7;
  339. }
  340. }
  341. @keyframes netpulse-vt-in-left {
  342. from {
  343. transform: translateX(-24%);
  344. opacity: 0.7;
  345. }
  346. }
  347. /* Reducir animaciones para las view transitions (SO) */
  348. @media (prefers-reduced-motion: reduce) {
  349. ::view-transition-old(*),
  350. ::view-transition-new(*) {
  351. animation: none !important;
  352. }
  353. }