:root {
  --bg: #03080a;
  --panel: rgba(5, 18, 21, 0.86);
  --line: rgba(89, 232, 222, 0.3);
  --cyan: #19e2db;
  --text: #efffff;
  --muted: #85a9aa;
  --danger: #ff5263;
  --lock-red: #ff3b56;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "IBM Plex Sans", sans-serif; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; transition: background-color 0.4s ease, color 0.4s ease; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* TELA DE LOGIN / GATE INICIAL */
.auth-gate-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 24px;
  backdrop-filter: blur(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.auth-gate-screen.gate-fade-out {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.auth-gate-card {
  position: relative;
  z-index: 10;
  width: min(440px, 100%);
  text-align: center;
  background: rgba(4, 18, 22, 0.88);
  border: 1.5px solid rgba(25, 226, 219, 0.45);
  border-radius: 16px;
  padding: 36px 28px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85), 0 0 40px rgba(25, 226, 219, 0.25);
  backdrop-filter: blur(20px);
}

.auth-gate-img-wrapper {
  position: relative;
  width: 165px;
  height: 165px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
}

.auth-gate-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(25, 226, 219, 0.75));
  animation: pulseGate 4s ease-in-out infinite;
  z-index: 2;
}

.gate-energy-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px dashed rgba(25, 226, 219, 0.45);
  box-shadow: 0 0 20px rgba(25, 226, 219, 0.2), inset 0 0 20px rgba(25, 226, 219, 0.15);
  animation: rotateRing 20s linear infinite;
  pointer-events: none;
}

@keyframes pulseGate {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(25, 226, 219, 0.6)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 38px rgba(25, 226, 219, 0.95)); }
}

@keyframes rotateRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.auth-gate-card h2 {
  font: 700 24px "Space Grotesk", sans-serif;
  color: #fff;
  margin: 0;
  letter-spacing: 1px;
}

.auth-gate-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 22px;
}

.auth-gate-card label {
  display: block;
  font: 600 11px "Space Grotesk", sans-serif;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-align: left;
}

.gate-input-wrap {
  display: flex;
  gap: 8px;
}

.gate-input-wrap input {
  flex: 1;
  background: #020c0e;
  border: 1px solid rgba(25, 226, 219, 0.35);
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gate-input-wrap input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(25, 226, 219, 0.4);
}

.gate-input-wrap button {
  background: var(--cyan);
  color: #031215;
  border: 0;
  padding: 0 22px;
  border-radius: 8px;
  font: 700 12px "Space Grotesk", sans-serif;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: opacity 0.2s;
}

.gate-input-wrap button:hover { opacity: 0.9; }

.gate-error-msg {
  display: block;
  color: var(--danger);
  font-size: 11px;
  margin-top: 8px;
  text-align: left;
}

/* FUNDO ESPACIAL E MARCA D'ÁGUA */
.space-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.5s ease;
  overflow: hidden;
}

.nebula {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 45% 40%, rgba(25, 226, 219, 0.14) 0%, transparent 60%),
              radial-gradient(circle at 82% 82%, rgba(147, 59, 255, 0.16) 0%, transparent 55%),
              radial-gradient(circle at 18% 78%, rgba(0, 180, 255, 0.12) 0%, transparent 50%);
}

.stars {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1.5px 1.5px at 25px 35px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 85px 140px, #19e2db, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 170px 90px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 260px 200px, #9bb8ff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 320px 50px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 410px 280px, #ffd56c, rgba(0,0,0,0));
  background-size: 450px 450px;
  animation: twinkle 5s ease-in-out infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.45; }
  100% { opacity: 0.95; }
}

.bg-watermark-logo {
  position: absolute;
  left: 2%;
  bottom: 0%;
  width: 460px;
  height: 460px;
  opacity: 0.18;
  filter: drop-shadow(0 0 35px rgba(25, 226, 219, 0.4));
  pointer-events: none;
  z-index: 1;
  animation: floatWatermark 8s ease-in-out infinite;
}
.bg-watermark-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes floatWatermark {
  0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.18; }
  50% { transform: translateY(-12px) rotate(1deg); opacity: 0.25; filter: drop-shadow(0 0 50px rgba(25, 226, 219, 0.6)); }
}

#space-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: 2;
  pointer-events: none;
}

.universe { min-height: 100vh; position: relative; overflow: hidden; z-index: 3; transition: background 0.4s; }

body.light-theme .space-background { opacity: 0; }

.universe.light {
  --bg: #e6f3f7;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(14, 138, 146, 0.35);
  --cyan: #02878d;
  --text: #0b272c;
  --muted: #41686e;
}

.universe.light #space-canvas {
  background: radial-gradient(circle at 50% 50%, #f0f9fc 0%, #d8edf3 55%, #bcdfe8 100%);
}

.light .topbar {
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(14, 138, 146, 0.22);
}
.light .brand strong, .light .brand span { color: #072a30; }
.light .outline-btn {
  background: rgba(255, 255, 255, 0.7);
  color: #0d3840;
  border-color: rgba(14, 138, 146, 0.35);
}
.light .node {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(14, 138, 146, 0.32);
  box-shadow: 0 8px 24px rgba(7, 58, 66, 0.08);
}
.light .node b { color: #08282e; }
.light .node small { color: #4b747b; }
.light .node .ext { color: #02878d; }
.light .category button {
  background: rgba(255, 255, 255, 0.9);
  color: #0b2e35;
  border-color: rgba(14, 138, 146, 0.4);
}
.light .widget {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(14, 138, 146, 0.3);
}
.light .clock strong { color: #082c33; }
.light .clock span, .light .clock small { color: #4b747b; }
.light .console-button, .light .calendar-button {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(14, 138, 146, 0.4);
  color: #02878d;
}

/* TOPBAR */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 68px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(50, 209, 201, 0.14);
  background: rgba(2, 9, 11, 0.7);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  letter-spacing: -0.4px;
}

.brand-logo-hd {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(25, 226, 219, 0.75));
  transition: transform 0.3s ease, filter 0.3s ease;
}
.brand-logo-hd:hover {
  transform: scale(1.12) rotate(4deg);
  filter: drop-shadow(0 0 20px rgba(0, 246, 255, 0.9));
}
.brand span { color: var(--cyan); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.outline-btn, .top-actions button {
  border: 1px solid var(--line);
  background: rgba(7, 20, 22, 0.55);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
}

.stage { position: relative; width: 100vw; height: 100vh; z-index: 4; }

#connections { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.link-line {
  stroke: var(--cyan);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
  animation: dash 1s linear infinite;
  filter: drop-shadow(0 0 5px var(--cyan));
}
@keyframes dash { to { stroke-dashoffset: -18; } }

/* NÚCLEO CENTRAL */
.core {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 400px;
  height: 400px;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.core > * { pointer-events: auto; }

.orbit {
  position: absolute;
  left: 50% !important;
  top: 50% !important;
  border-radius: 50%;
  pointer-events: none;
}
.orbit-a {
  width: 280px;
  height: 280px;
  border: 1px dashed rgba(37, 225, 216, 0.45);
  animation: rot-a 24s linear infinite;
}
.orbit-b {
  width: 350px;
  height: 350px;
  border: 1px solid rgba(90, 102, 255, 0.25);
  border-left-color: rgba(22, 229, 225, 0.55);
  border-right-color: rgba(22, 229, 225, 0.45);
  animation: rot-b 32s linear infinite reverse;
}
.orbit-c {
  width: 410px;
  height: 410px;
  border: 1px dotted rgba(37, 225, 216, 0.25);
  animation: rot-c 48s linear infinite;
}

@keyframes rot-a {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes rot-b {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes rot-c {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.engine {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200px;
  height: 200px;
  border: 1.5px solid rgba(113, 239, 231, 0.8);
  border-radius: 50%;
  overflow: hidden;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 50px rgba(23, 232, 220, 0.45), inset 0 0 24px rgba(0, 0, 0, 0.8);
  z-index: 2;
  transition: transform 0.3s ease;
}
.engine:hover { transform: translate(-50%, -50%) scale(1.05); }
.engine video { width: 100%; height: 100%; object-fit: cover; filter: saturate(1.3) hue-rotate(115deg); }
.engine span {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 4px, rgba(38, 255, 242, 0.06) 5px);
  pointer-events: none;
}

.coord {
  position: absolute;
  font-style: normal;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--muted);
  background: rgba(5, 17, 19, 0.72);
  border: 1px solid rgba(117, 232, 227, 0.23);
  padding: 4px 6px;
  white-space: nowrap;
}
.coord-a { top: 38px; left: 14px; }
.coord-b { right: 14px; bottom: 38px; }

/* NÓS E CARDS (COM TRANSIÇÃO SUAVE DE ESCALA) */
.node, .category {
  position: absolute;
  transform-origin: center center;
  z-index: 15;
  transition: transform 0.2s ease, border-color 0.18s, box-shadow 0.18s;
}

.node {
  min-width: 144px;
  max-width: 198px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: linear-gradient(110deg, rgba(4, 16, 18, 0.94), rgba(9, 36, 38, 0.65));
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  will-change: transform;
}
.node:before {
  content: "";
  width: 3px;
  align-self: stretch;
  border-radius: 4px;
  background: var(--node-color, var(--cyan));
  box-shadow: 0 0 10px var(--node-color, var(--cyan));
}
.node:hover, .node.focused { border-color: var(--cyan); box-shadow: 0 0 24px rgba(25, 226, 219, 0.3); }
.node b, .node small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.node b { font-family: "Space Grotesk", sans-serif; font-weight: 500; font-size: 11px; }
.node small { color: var(--muted); font-size: 8px; margin-top: 2px; }
.node .ext { margin-left: auto; color: var(--cyan); font-style: normal; }

.category button {
  border: 1px solid color-mix(in srgb, var(--cat, #19e2db) 45%, transparent);
  background: rgba(5, 17, 19, 0.8);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 10px;
  letter-spacing: 0.7px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.category button:hover { box-shadow: 0 0 15px color-mix(in srgb, var(--cat, #19e2db) 35%, transparent); }

.widget, .sticky {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 19;
  background: rgba(5, 19, 22, 0.84);
  border: 1px solid rgba(124, 231, 226, 0.28);
  backdrop-filter: blur(12px);
  box-shadow: 0 9px 26px rgba(0, 0, 0, 0.25);
  color: var(--text);
  will-change: transform;
}
.widget { padding: 10px 12px; border-radius: 7px; }
.widget small { display: block; font-size: 8px; letter-spacing: 1px; color: var(--muted); }
.clock { width: 120px; text-align: center; }
.clock strong { display: block; font: 600 21px "Space Grotesk", sans-serif; margin-top: 5px; }
.clock span { font-size: 8px; color: var(--muted); }

.sticky { width: 160px; min-height: 73px; border-radius: 7px; padding: 10px; white-space: pre-wrap; font-size: 11px; line-height: 1.35; cursor: grab; }
.sticky:active { cursor: grabbing; }
.sticky small { display: block; font-size: 8px; margin-bottom: 5px; color: inherit; opacity: 0.65; }
.sticky.cyan { background: rgba(4, 54, 58, 0.86); }
.sticky.amber { background: rgba(96, 61, 10, 0.85); border-color: rgba(255, 208, 91, 0.45); }
.sticky.violet { background: rgba(52, 29, 92, 0.86); border-color: rgba(182, 146, 255, 0.4); }

/* BURACO NEGRO 3D */
.black-hole {
  position: absolute;
  z-index: 13;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #000 0% 40%, #15062b 48%, #8537f5 68%, rgba(157, 66, 255, 0.25) 82%, transparent 92%);
  box-shadow: 0 0 28px rgba(147, 59, 255, 0.95);
  cursor: grab;
  perspective: 600px;
}
.black-hole i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px dashed rgba(214, 168, 255, 0.85);
  box-shadow: 0 0 22px rgba(186, 114, 255, 0.7), inset 0 0 14px rgba(220, 160, 255, 0.4);
  transform-style: preserve-3d;
  animation: rotate-3d-accretion 6s linear infinite;
  pointer-events: none;
}
@keyframes rotate-3d-accretion {
  0% { transform: translate(-50%, -50%) rotateX(72deg) rotateY(18deg) rotateZ(0deg); }
  50% { transform: translate(-50%, -50%) rotateX(72deg) rotateY(-18deg) rotateZ(180deg); }
  100% { transform: translate(-50%, -50%) rotateX(72deg) rotateY(18deg) rotateZ(360deg); }
}

.meteor {
  position: absolute;
  left: 86%;
  top: 8%;
  z-index: 28;
  width: 18px;
  height: 4px;
  background: linear-gradient(90deg, transparent, #fff9c2, #ffcf55);
  box-shadow: 0 0 15px #ffd772;
  transform-origin: right;
  animation: meteor 3s ease-in forwards;
}
.meteor i { display: block; width: 140px; height: 2px; background: linear-gradient(90deg, transparent, #fbe984); transform: translateX(-125px); }
@keyframes meteor { to { transform: translate(var(--mx), var(--my)) scale(0.1); opacity: 0.2; } }

.supernova { position: fixed; inset: 0; z-index: 100; background: white; animation: supernova 1.5s ease-out forwards; pointer-events: none; }
@keyframes supernova { 0% { opacity: 0; } 25% { opacity: 0.98; } 100% { opacity: 0; } }

.calendar-button {
  position: absolute;
  right: 30px;
  bottom: 18px;
  z-index: 30;
  border: 1px solid var(--line);
  background: rgba(4, 18, 20, 0.9);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 10px;
}

/* BOTÕES DE RUNA NÓRDICA */
.console-button {
  position: absolute;
  left: 25px;
  bottom: 26px;
  z-index: 30;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(159, 241, 236, 0.45);
  background: rgba(4, 16, 20, 0.9);
  color: var(--cyan);
  box-shadow: 0 0 20px rgba(22, 229, 225, 0.22);
  cursor: grab;
  user-select: none;
  display: grid;
  place-items: center;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.console-button:active { cursor: grabbing; }
.console-button i { font-style: normal; font-size: 20px; line-height: 1; text-shadow: 0 0 8px var(--cyan); pointer-events: none; }
.console-button:hover { border-color: var(--cyan); box-shadow: 0 0 24px rgba(25, 226, 219, 0.5); transform: scale(1.06); }
.console-button.holding {
  animation: pulse-ring 5s linear forwards;
  border-color: #ffd772 !important;
  color: #ffd772 !important;
}
.console-button.holding i { text-shadow: 0 0 10px #ffd772; }

.lock-rune-btn {
  border-color: rgba(255, 59, 86, 0.45) !important;
  color: var(--lock-red) !important;
  box-shadow: 0 0 20px rgba(255, 59, 86, 0.25) !important;
}
.lock-rune-btn i { text-shadow: 0 0 8px var(--lock-red) !important; }
.lock-rune-btn:hover {
  border-color: #ff5263 !important;
  box-shadow: 0 0 28px rgba(255, 82, 99, 0.6) !important;
  color: #fff !important;
  transform: scale(1.08) !important;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(255, 215, 114, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(255, 215, 114, 0.25); }
  100% { box-shadow: 0 0 0 20px rgba(255, 215, 114, 0); }
}

/* =========================================================
   BARRA ALINHADA DO MODO SERVIÇOS COM AJUSTES DE TAMANHO
   ========================================================= */
.editor-bar {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  height: 44px;
  gap: 8px;
  padding: 0 14px;
  background: rgba(4, 18, 22, 0.94);
  border: 1px solid var(--cyan);
  border-radius: 9px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 20px rgba(25, 226, 219, 0.15);
  backdrop-filter: blur(12px);
}
.editor-bar b {
  display: inline-flex;
  align-items: center;
  height: 30px;
  font: 600 11px "Space Grotesk", sans-serif;
  color: var(--cyan);
  letter-spacing: 1px;
  margin-right: 2px;
  white-space: nowrap;
}
.editor-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  line-height: 1;
  padding: 0 12px;
  border: 1px solid rgba(89, 232, 222, 0.3);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 6px;
  font: 500 11px "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.editor-bar button:hover {
  background: rgba(25, 226, 219, 0.15);
  border-color: var(--cyan);
  color: #fff;
}
.editor-bar .primary {
  background: var(--cyan) !important;
  color: #002426 !important;
  border-color: var(--cyan) !important;
  font-weight: 700;
}

/* GRUPO DE BOTÕES DE AJUSTE DENTRO DO MODO SERVIÇOS */
.editor-size-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(89, 232, 222, 0.25);
  border-radius: 6px;
  padding: 2px 5px;
  height: 30px;
}
.editor-size-tag {
  font: 600 9px "Space Grotesk", sans-serif;
  color: var(--cyan);
  text-transform: uppercase;
  margin-right: 3px;
  letter-spacing: 0.5px;
}
.editor-size-btn {
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  display: grid !important;
  place-items: center !important;
}

/* CALENDÁRIO FLUTUANTE */
.calendar-dock {
  position: fixed;
  right: 18px;
  bottom: 64px;
  width: 365px;
  max-height: calc(100vh - 90px);
  z-index: 70;
  background: linear-gradient(160deg, rgba(8, 26, 30, 0.98), rgba(3, 11, 15, 0.98));
  border: 1px solid rgba(89, 232, 222, 0.35);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 25px rgba(25, 226, 219, 0.15);
  overflow-y: auto;
  backdrop-filter: blur(14px);
}
.calendar-dock header {
  padding: 14px 18px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(89, 232, 222, 0.18);
}
.calendar-title-wrap small {
  font-size: 8px;
  color: var(--cyan);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: block;
}
.calendar-title-wrap h2 {
  font: 600 15px "Space Grotesk", sans-serif;
  margin: 3px 0 0;
  color: #efffff;
}

.calendar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.calendar-actions #export-tasks {
  background: rgba(25, 226, 219, 0.12);
  border: 1px solid rgba(89, 232, 222, 0.4);
  color: #19e2db;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.calendar-actions #export-tasks:hover {
  background: rgba(25, 226, 219, 0.25);
  color: #fff;
}

.cal-close-red-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 82, 99, 0.4) !important;
  border-radius: 6px;
  background: rgba(255, 82, 99, 0.12) !important;
  color: #ff5263 !important;
  font-size: 20px !important;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cal-close-red-btn:hover {
  background: #ff5263 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(255, 82, 99, 0.6);
  transform: scale(1.06);
}

.calendar-body { padding: 12px 16px 16px; }

.calendar-month {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  padding: 4px 0 10px;
}
.calendar-month button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(89, 232, 222, 0.25);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--cyan);
  font-size: 16px;
  cursor: pointer;
}
.calendar-month strong {
  text-align: center;
  font: 600 13px "Space Grotesk", sans-serif;
  color: #efffff;
  text-transform: capitalize;
}

.calendar-weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font: 600 9px "Space Grotesk", sans-serif;
  text-align: center;
}

.calendar-cell, .calendar-empty {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: #c9e9e7;
  font-size: 11px;
}
.calendar-cell { cursor: pointer; transition: all 0.15s; }
.calendar-cell:hover { background: rgba(25, 226, 219, 0.15); border-color: rgba(25, 226, 219, 0.4); }
.calendar-cell.is-selected {
  background: rgba(25, 226, 219, 0.25);
  color: #fff;
  border-color: var(--cyan);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(25, 226, 219, 0.3);
}
.calendar-cell.is-today { color: #ffd56c; font-weight: 700; }
.calendar-cell.has-task:after {
  content: "";
  width: 4px;
  height: 4px;
  position: absolute;
  margin-top: 20px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

.calendar-day {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(89, 232, 222, 0.18);
}
.calendar-day-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.calendar-day-title span { display: block; color: var(--muted); font-size: 10px; text-transform: capitalize; }
.calendar-day-title strong { color: #fff; font: 600 14px "Space Grotesk", sans-serif; text-transform: capitalize; }
.calendar-day-title button {
  padding: 5px 10px;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  background: var(--cyan);
  color: #031215;
  font-weight: 700;
  font-size: 10px;
  cursor: pointer;
}

.task-list { padding: 10px 0 0; }
.task {
  padding: 10px;
  border: 1px solid rgba(89, 232, 222, 0.18);
  border-radius: 6px;
  background: rgba(4, 18, 22, 0.6);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.task input { margin-top: 3px; accent-color: var(--cyan); cursor: pointer; }
.task div { flex: 1; }
.task b { font-size: 12px; color: #fff; display: block; }
.task span { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.task button { border: 0; background: none; color: var(--cyan); cursor: pointer; font-size: 11px; font-weight: 600; }
.tasks-empty { min-height: 50px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }

/* MODAIS & FORMULÁRIOS */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}
.modal {
  width: min(640px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #091a1e;
  border: 1px solid var(--cyan);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.7), 0 0 30px rgba(25, 226, 219, 0.2);
}
.modal h2 { font: 600 20px "Space Grotesk", sans-serif; margin: 0 0 6px; color: #fff; }
.modal p { font-size: 11px; color: var(--muted); }
.modal label { display: block; font-size: 10px; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; font-weight: 600; }
.modal input, .modal select, .modal textarea {
  width: 100%;
  background: #061316;
  border: 1px solid rgba(89, 232, 222, 0.3);
  color: #fff;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12px;
}
.modal textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal-actions button { border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; background: transparent; color: var(--text); cursor: pointer; font-size: 12px; }
.danger { color: var(--danger) !important; border-color: rgba(255, 82, 99, 0.45) !important; }

/* HPANEL MASTER DASHBOARD */
#hpanel-dashboard {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0b0f19;
  color: #d1d5db;
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: "IBM Plex Sans", sans-serif;
}

.hp-sidebar {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  flex-shrink: 0;
  background: #111827;
  border-right: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  height: 100vh;
  overflow-y: auto;
}

.hp-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid #1f2937;
}
.hp-logo {
  width: 36px;
  height: 36px;
  background: var(--cyan);
  color: #031215;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.hp-brand strong { display: block; font-size: 15px; color: #fff; }
.hp-brand small { font-size: 10px; color: #9ca3af; }

.hp-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
  flex: 1;
}
.hp-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.hp-nav-item span { font-size: 16px; color: #6b7280; }
.hp-nav-item:hover { background: #1f2937; color: #f3f4f6; }
.hp-nav-item.active { background: rgba(25, 226, 219, 0.12); color: var(--cyan); font-weight: 600; }
.hp-nav-item.active span { color: var(--cyan); }

.hp-sidebar-footer { padding-top: 16px; border-top: 1px solid #1f2937; }

.hp-main {
  flex: 1;
  min-width: 0;
  width: calc(100vw - 260px);
  max-width: calc(100vw - 260px);
  display: flex;
  flex-direction: column;
  background: #0b0f19;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
}

.hp-topbar {
  height: 64px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid #1f2937;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111827;
  flex-shrink: 0;
}
.hp-breadcrumb { font-size: 13px; color: #9ca3af; display: flex; gap: 8px; align-items: center; }
.hp-breadcrumb strong { color: #f3f4f6; }
.hp-breadcrumb i { font-style: normal; color: #4b5563; }

.hp-user-status { display: flex; align-items: center; gap: 14px; }
.hp-badge { background: #065f46; color: #34d399; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }

.hp-content {
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}
.hp-view-pane {
  display: none;
  width: 100%;
  min-width: 0;
}
.hp-view-pane.active { display: block; }

.hp-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.hp-card h3 { margin: 0 0 16px; font-size: 16px; color: #f3f4f6; font-family: "Space Grotesk", sans-serif; }
.hp-card-form label { display: block; font-size: 11px; color: #9ca3af; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.hp-card-form input, .hp-card-form select, .hp-card-form textarea {
  width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  color: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
}
.hp-card-form textarea { min-height: 80px; }

.hp-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.hp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.hp-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #e5e7eb;
  cursor: pointer;
}
.hp-checkbox-label input { width: 16px; height: 16px; accent-color: var(--cyan); }

.hp-effects-box { display: grid; gap: 12px; }
.hp-checkbox-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  cursor: pointer;
  align-items: flex-start;
}
.hp-checkbox-card input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--cyan); }
.hp-checkbox-card strong { display: block; font-size: 14px; color: #f3f4f6; }
.hp-checkbox-card small { display: block; font-size: 11px; color: #9ca3af; margin-top: 2px; }

.hp-btn-primary {
  background: var(--cyan);
  color: #031215;
  border: 0;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.hp-btn-primary:hover { opacity: 0.9; }

.hp-btn-outline {
  background: transparent;
  border: 1px solid #374151;
  color: #d1d5db;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.hp-btn-outline:hover { background: #1f2937; color: #fff; }

/* TABELA COM CONTENÇÃO RIGOROSA */
.hp-table-container {
  width: 100%;
  overflow: hidden;
}

.hp-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 8px;
  font-size: 13px;
}

.hp-table th,
.hp-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #1f2937;
  color: #e5e7eb;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-table th {
  color: #9ca3af;
  font-weight: 500;
  text-align: left;
}

.hp-table td strong,
.hp-table td small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-url-box {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-url-box a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cyan);
  text-decoration: none;
}

.hp-url-box a:hover {
  text-decoration: underline;
}

/* ISOLAMENTO DA COLUNA DE AÇÕES COM BOTÃO EXCLUIR SEMPRE VISÍVEL */
.hp-table td.hp-actions-cell,
.hp-table th:last-child {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  text-align: right;
  padding-right: 4px;
}

.hp-actions-wrap {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  white-space: nowrap;
}

.hp-tag { background: #1f2937; padding: 3px 8px; border-radius: 4px; font-size: 11px; border: 1px solid #374151; }
.hp-action-btn {
  padding: 6px 11px;
  border-radius: 4px;
  border: 1px solid #374151;
  background: #1f2937;
  color: #d1d5db;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}
.hp-action-btn:hover { background: #374151; color: #fff; }
.hp-action-btn.danger { color: var(--danger); border-color: rgba(255, 82, 99, 0.4); }

.task-alert {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 85;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 17px;
  border: 1px solid var(--cyan);
  border-radius: 9px;
  background: rgba(2, 23, 26, 0.96);
  box-shadow: 0 0 42px rgba(25, 226, 219, 0.32);
  animation: alert 0.25s ease-out;
}
.task-alert:before { content: "◎"; font-size: 32px; color: var(--cyan); }
.task-alert b { display: block; font: 600 14px "Space Grotesk", sans-serif; }
.task-alert span { font-size: 10px; color: var(--muted); }
.task-alert button { border: 0; background: transparent; color: white; font-size: 18px; cursor: pointer; }
@keyframes alert { from { opacity: 0; transform: translate(-50%, -45%) scale(0.95); } to { opacity: 1; transform: translate(-50%, -50%); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 500;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #071b1e;
  font-size: 11px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.editing .node, .editing .category, .editing .core, .editing .widget, .editing .sticky, .editing .black-hole, .editing .console-button { cursor: grab; }
.editing .node:active, .editing .core:active { cursor: grabbing; }

@media (max-width: 860px) {
  #hpanel-dashboard { flex-direction: column; }
  .hp-sidebar { width: 100%; border-right: 0; border-bottom: 1px solid #1f2937; height: auto; }
  .hp-main { width: 100vw; max-width: 100vw; }
  .hp-grid-3, .hp-grid-2 { grid-template-columns: 1fr; }
  .hp-content { padding: 16px; }
  .bg-watermark-logo { width: 280px; height: 280px; opacity: 0.12; }
}